From e68945b4d2e48d9fa9574a1c18472abb0aa52448 Mon Sep 17 00:00:00 2001 From: Chris Howson Date: Fri, 20 Dec 2024 21:52:14 +0000 Subject: [PATCH] fix(parser): ensure sitemap & url are arrays (#158) * fix(parser): ensure sitemap & url are arrays * 3.2.20 --------- Co-authored-by: chris-howson-metagenics Co-authored-by: GitHub Action --- package-lock.json | 4 ++-- package.json | 2 +- src/assets/sitemapper.js | 5 ++++- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/package-lock.json b/package-lock.json index e286fff..80f40f1 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "sitemapper", - "version": "3.2.19", + "version": "3.2.20", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "sitemapper", - "version": "3.2.19", + "version": "3.2.20", "license": "MIT", "dependencies": { "fast-xml-parser": "^4.5.0", diff --git a/package.json b/package.json index c66fc8a..e89d005 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "sitemapper", - "version": "3.2.19", + "version": "3.2.20", "description": "Parser for XML Sitemaps to be used with Robots.txt and web crawlers", "keywords": [ "parse", diff --git a/src/assets/sitemapper.js b/src/assets/sitemapper.js index 1b1abc6..b415ec4 100644 --- a/src/assets/sitemapper.js +++ b/src/assets/sitemapper.js @@ -220,7 +220,10 @@ export default class Sitemapper { } // Parse XML using fast-xml-parser - const parser = new XMLParser(); + const parser = new XMLParser({ + isArray: (tagName) => + ['sitemap', 'url'].some((value) => value === tagName), + }); const data = parser.parse(responseBody.toString());