From 636de50d9f876a8a0df3218c6054e74956e384d8 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 6 Jun 2023 17:34:57 +0000 Subject: [PATCH 1/2] build(deps): bump fast-xml-parser from 3.16.0 to 4.2.4 Bumps [fast-xml-parser](https://github.com/NaturalIntelligence/fast-xml-parser) from 3.16.0 to 4.2.4. - [Release notes](https://github.com/NaturalIntelligence/fast-xml-parser/releases) - [Changelog](https://github.com/NaturalIntelligence/fast-xml-parser/blob/master/CHANGELOG.md) - [Commits](https://github.com/NaturalIntelligence/fast-xml-parser/commits) --- updated-dependencies: - dependency-name: fast-xml-parser dependency-type: direct:production ... Signed-off-by: dependabot[bot] --- package-lock.json | 14 +++++++++++--- package.json | 2 +- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/package-lock.json b/package-lock.json index 19387635..21957d0c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -6771,9 +6771,12 @@ "dev": true }, "fast-xml-parser": { - "version": "3.16.0", - "resolved": "https://registry.npmjs.org/fast-xml-parser/-/fast-xml-parser-3.16.0.tgz", - "integrity": "sha512-U+bpScacfgnfNfIKlWHDu4u6rtOaCyxhblOLJ8sZPkhsjgGqdZmVPBhdOyvdMGCDt8CsAv+cssOP3NzQptNt2w==" + "version": "4.2.4", + "resolved": "https://registry.npmjs.org/fast-xml-parser/-/fast-xml-parser-4.2.4.tgz", + "integrity": "sha512-fbfMDvgBNIdDJLdLOwacjFAPYt67tr31H9ZhWSm45CDAxvd0I6WTlSOUo7K2P/K5sA5JgMKG64PI3DMcaFdWpQ==", + "requires": { + "strnum": "^1.0.5" + } }, "fastq": { "version": "1.6.0", @@ -17006,6 +17009,11 @@ "integrity": "sha1-IrD6OkE4WzO+PzMVUbu4N/oM164=", "dev": true }, + "strnum": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/strnum/-/strnum-1.0.5.tgz", + "integrity": "sha512-J8bbNyKKXl5qYcR36TIO8W3mVGVHrmmxsd5PAItGkmyzwJvybiw2IVq5nqd0i4LSNSkB/sx9VHllbfFdr9k1JA==" + }, "stubs": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/stubs/-/stubs-3.0.0.tgz", diff --git a/package.json b/package.json index a107545b..fb9bed04 100644 --- a/package.json +++ b/package.json @@ -45,7 +45,7 @@ "abab": "^2.0.3", "debug": "^4.1.1", "eventemitter3": "^4.0.0", - "fast-xml-parser": "^3.16.0", + "fast-xml-parser": "^4.2.4", "file-type": "^10.11.0", "follow-redirects": "^1.10.0", "isutf8": "^2.1.0", From d04c8e8863e5f21890e24bf70fb425aabf2b38a6 Mon Sep 17 00:00:00 2001 From: Koza Date: Wed, 21 Jun 2023 14:42:33 +0200 Subject: [PATCH 2/2] Fix code after fast-xml-parser version bump --- src/lib/request/helpers/data.ts | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/lib/request/helpers/data.ts b/src/lib/request/helpers/data.ts index 6315ecd5..94dacaa6 100644 --- a/src/lib/request/helpers/data.ts +++ b/src/lib/request/helpers/data.ts @@ -18,7 +18,7 @@ import { isURLSearchParams, isObject, isStream, isFormData, isArrayBuffer, isFil import { getVersion, uniqueId } from './../../utils'; import { FsRequestOptions, FsResponse } from './../types'; import { set } from './headers'; -import * as parser from 'fast-xml-parser'; +import { XMLParser, XMLValidator } from 'fast-xml-parser'; import Debug from 'debug'; const debug = Debug('fs:request:data'); @@ -99,11 +99,14 @@ export const parseResponse = async (response: FsResponse): Promise = data = bufferToString(response.data); } - if (parser.validate(data) === true) { - response.data = parser.parse(data, { + if (XMLValidator.validate(data) === true) { + const parser = new XMLParser({ + ignoreDeclaration: true, ignoreAttributes : true, trimValues: true, }); + + response.data = parser.parse(data); } }