Skip to content

Commit 90ef3f8

Browse files
committed
chore(clients): call decode for HTML entities in XML parser
1 parent fe92f4b commit 90ef3f8

File tree

51 files changed

+101
-228
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+101
-228
lines changed

clients/client-auto-scaling/package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,12 @@
5757
"@aws-sdk/util-utf8-node": "3.13.1",
5858
"@aws-sdk/util-waiter": "3.15.0",
5959
"fast-xml-parser": "3.19.0",
60+
"he": "1.2.0",
6061
"tslib": "^2.0.0"
6162
},
6263
"devDependencies": {
6364
"@aws-sdk/client-documentation-generator": "3.15.0",
65+
"@types/he": "1.1.1",
6466
"@types/node": "^12.7.5",
6567
"downlevel-dts": "0.7.0",
6668
"jest": "^26.1.0",

clients/client-auto-scaling/protocols/Aws_query.ts

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -343,6 +343,7 @@ import {
343343
SerdeContext as __SerdeContext,
344344
} from "@aws-sdk/types";
345345
import { parse as xmlParse } from "fast-xml-parser";
346+
import { decode as heDecode } from "he";
346347

347348
export const serializeAws_queryAttachInstancesCommand = async (
348349
input: AttachInstancesCommandInput,
@@ -9378,14 +9379,6 @@ const buildHttpRpcRequest = async (
93789379
return new __HttpRequest(contents);
93799380
};
93809381

9381-
const decodeEscapedXML = (str: string) =>
9382-
str
9383-
.replace(/&/g, "&")
9384-
.replace(/'/g, "'")
9385-
.replace(/"/g, '"')
9386-
.replace(/>/g, ">")
9387-
.replace(/&lt;/g, "<");
9388-
93899382
const parseBody = (streamBody: any, context: __SerdeContext): any =>
93909383
collectBodyString(streamBody, context).then((encoded) => {
93919384
if (encoded.length) {
@@ -9394,7 +9387,7 @@ const parseBody = (streamBody: any, context: __SerdeContext): any =>
93949387
ignoreAttributes: false,
93959388
parseNodeValue: false,
93969389
trimValues: false,
9397-
tagValueProcessor: (val, tagName) => (val.trim() === "" ? "" : decodeEscapedXML(val)),
9390+
tagValueProcessor: (val, tagName) => (val.trim() === "" ? "" : heDecode(val)),
93989391
});
93999392
const textNodeName = "#text";
94009393
const key = Object.keys(parsedObj)[0];

clients/client-cloudformation/package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,11 +57,13 @@
5757
"@aws-sdk/util-utf8-node": "3.13.1",
5858
"@aws-sdk/util-waiter": "3.15.0",
5959
"fast-xml-parser": "3.19.0",
60+
"he": "1.2.0",
6061
"tslib": "^2.0.0",
6162
"uuid": "^8.3.2"
6263
},
6364
"devDependencies": {
6465
"@aws-sdk/client-documentation-generator": "3.15.0",
66+
"@types/he": "1.1.1",
6567
"@types/node": "^12.7.5",
6668
"@types/uuid": "^8.3.0",
6769
"downlevel-dts": "0.7.0",

clients/client-cloudformation/protocols/Aws_query.ts

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -318,6 +318,7 @@ import {
318318
SerdeContext as __SerdeContext,
319319
} from "@aws-sdk/types";
320320
import { parse as xmlParse } from "fast-xml-parser";
321+
import { decode as heDecode } from "he";
321322
import { v4 as generateIdempotencyToken } from "uuid";
322323

323324
export const serializeAws_queryCancelUpdateStackCommand = async (
@@ -9645,14 +9646,6 @@ const buildHttpRpcRequest = async (
96459646
return new __HttpRequest(contents);
96469647
};
96479648

9648-
const decodeEscapedXML = (str: string) =>
9649-
str
9650-
.replace(/&amp;/g, "&")
9651-
.replace(/&apos;/g, "'")
9652-
.replace(/&quot;/g, '"')
9653-
.replace(/&gt;/g, ">")
9654-
.replace(/&lt;/g, "<");
9655-
96569649
const parseBody = (streamBody: any, context: __SerdeContext): any =>
96579650
collectBodyString(streamBody, context).then((encoded) => {
96589651
if (encoded.length) {
@@ -9661,7 +9654,7 @@ const parseBody = (streamBody: any, context: __SerdeContext): any =>
96619654
ignoreAttributes: false,
96629655
parseNodeValue: false,
96639656
trimValues: false,
9664-
tagValueProcessor: (val, tagName) => (val.trim() === "" ? "" : decodeEscapedXML(val)),
9657+
tagValueProcessor: (val, tagName) => (val.trim() === "" ? "" : heDecode(val)),
96659658
});
96669659
const textNodeName = "#text";
96679660
const key = Object.keys(parsedObj)[0];

clients/client-cloudfront/package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,12 @@
5858
"@aws-sdk/util-waiter": "3.15.0",
5959
"@aws-sdk/xml-builder": "3.14.0",
6060
"fast-xml-parser": "3.19.0",
61+
"he": "1.2.0",
6162
"tslib": "^2.0.0"
6263
},
6364
"devDependencies": {
6465
"@aws-sdk/client-documentation-generator": "3.15.0",
66+
"@types/he": "1.1.1",
6567
"@types/node": "^12.7.5",
6668
"downlevel-dts": "0.7.0",
6769
"jest": "^26.1.0",

clients/client-cloudfront/protocols/Aws_restXml.ts

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -487,6 +487,7 @@ import {
487487
} from "@aws-sdk/types";
488488
import { XmlNode as __XmlNode, XmlText as __XmlText } from "@aws-sdk/xml-builder";
489489
import { parse as xmlParse } from "fast-xml-parser";
490+
import { decode as heDecode } from "he";
490491

491492
export const serializeAws_restXmlCreateCachePolicyCommand = async (
492493
input: CreateCachePolicyCommandInput,
@@ -18506,14 +18507,6 @@ const isSerializableHeaderValue = (value: any): boolean =>
1850618507
(!Object.getOwnPropertyNames(value).includes("length") || value.length != 0) &&
1850718508
(!Object.getOwnPropertyNames(value).includes("size") || value.size != 0);
1850818509

18509-
const decodeEscapedXML = (str: string) =>
18510-
str
18511-
.replace(/&amp;/g, "&")
18512-
.replace(/&apos;/g, "'")
18513-
.replace(/&quot;/g, '"')
18514-
.replace(/&gt;/g, ">")
18515-
.replace(/&lt;/g, "<");
18516-
1851718510
const parseBody = (streamBody: any, context: __SerdeContext): any =>
1851818511
collectBodyString(streamBody, context).then((encoded) => {
1851918512
if (encoded.length) {
@@ -18522,7 +18515,7 @@ const parseBody = (streamBody: any, context: __SerdeContext): any =>
1852218515
ignoreAttributes: false,
1852318516
parseNodeValue: false,
1852418517
trimValues: false,
18525-
tagValueProcessor: (val, tagName) => (val.trim() === "" ? "" : decodeEscapedXML(val)),
18518+
tagValueProcessor: (val, tagName) => (val.trim() === "" ? "" : heDecode(val)),
1852618519
});
1852718520
const textNodeName = "#text";
1852818521
const key = Object.keys(parsedObj)[0];

clients/client-cloudsearch/package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,12 @@
5656
"@aws-sdk/util-utf8-browser": "3.13.1",
5757
"@aws-sdk/util-utf8-node": "3.13.1",
5858
"fast-xml-parser": "3.19.0",
59+
"he": "1.2.0",
5960
"tslib": "^2.0.0"
6061
},
6162
"devDependencies": {
6263
"@aws-sdk/client-documentation-generator": "3.15.0",
64+
"@types/he": "1.1.1",
6365
"@types/node": "^12.7.5",
6466
"downlevel-dts": "0.7.0",
6567
"jest": "^26.1.0",

clients/client-cloudsearch/protocols/Aws_query.ts

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,7 @@ import {
169169
SerdeContext as __SerdeContext,
170170
} from "@aws-sdk/types";
171171
import { parse as xmlParse } from "fast-xml-parser";
172+
import { decode as heDecode } from "he";
172173

173174
export const serializeAws_queryBuildSuggestersCommand = async (
174175
input: BuildSuggestersCommandInput,
@@ -4860,14 +4861,6 @@ const buildHttpRpcRequest = async (
48604861
return new __HttpRequest(contents);
48614862
};
48624863

4863-
const decodeEscapedXML = (str: string) =>
4864-
str
4865-
.replace(/&amp;/g, "&")
4866-
.replace(/&apos;/g, "'")
4867-
.replace(/&quot;/g, '"')
4868-
.replace(/&gt;/g, ">")
4869-
.replace(/&lt;/g, "<");
4870-
48714864
const parseBody = (streamBody: any, context: __SerdeContext): any =>
48724865
collectBodyString(streamBody, context).then((encoded) => {
48734866
if (encoded.length) {
@@ -4876,7 +4869,7 @@ const parseBody = (streamBody: any, context: __SerdeContext): any =>
48764869
ignoreAttributes: false,
48774870
parseNodeValue: false,
48784871
trimValues: false,
4879-
tagValueProcessor: (val, tagName) => (val.trim() === "" ? "" : decodeEscapedXML(val)),
4872+
tagValueProcessor: (val, tagName) => (val.trim() === "" ? "" : heDecode(val)),
48804873
});
48814874
const textNodeName = "#text";
48824875
const key = Object.keys(parsedObj)[0];

clients/client-cloudwatch/package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,12 @@
5757
"@aws-sdk/util-utf8-node": "3.13.1",
5858
"@aws-sdk/util-waiter": "3.15.0",
5959
"fast-xml-parser": "3.19.0",
60+
"he": "1.2.0",
6061
"tslib": "^2.0.0"
6162
},
6263
"devDependencies": {
6364
"@aws-sdk/client-documentation-generator": "3.15.0",
65+
"@types/he": "1.1.1",
6466
"@types/node": "^12.7.5",
6567
"downlevel-dts": "0.7.0",
6668
"jest": "^26.1.0",

clients/client-cloudwatch/protocols/Aws_query.ts

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,7 @@ import {
191191
SerdeContext as __SerdeContext,
192192
} from "@aws-sdk/types";
193193
import { parse as xmlParse } from "fast-xml-parser";
194+
import { decode as heDecode } from "he";
194195

195196
export const serializeAws_queryDeleteAlarmsCommand = async (
196197
input: DeleteAlarmsCommandInput,
@@ -6351,14 +6352,6 @@ const buildHttpRpcRequest = async (
63516352
return new __HttpRequest(contents);
63526353
};
63536354

6354-
const decodeEscapedXML = (str: string) =>
6355-
str
6356-
.replace(/&amp;/g, "&")
6357-
.replace(/&apos;/g, "'")
6358-
.replace(/&quot;/g, '"')
6359-
.replace(/&gt;/g, ">")
6360-
.replace(/&lt;/g, "<");
6361-
63626355
const parseBody = (streamBody: any, context: __SerdeContext): any =>
63636356
collectBodyString(streamBody, context).then((encoded) => {
63646357
if (encoded.length) {
@@ -6367,7 +6360,7 @@ const parseBody = (streamBody: any, context: __SerdeContext): any =>
63676360
ignoreAttributes: false,
63686361
parseNodeValue: false,
63696362
trimValues: false,
6370-
tagValueProcessor: (val, tagName) => (val.trim() === "" ? "" : decodeEscapedXML(val)),
6363+
tagValueProcessor: (val, tagName) => (val.trim() === "" ? "" : heDecode(val)),
63716364
});
63726365
const textNodeName = "#text";
63736366
const key = Object.keys(parsedObj)[0];

clients/client-docdb/package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,12 @@
5858
"@aws-sdk/util-utf8-node": "3.13.1",
5959
"@aws-sdk/util-waiter": "3.15.0",
6060
"fast-xml-parser": "3.19.0",
61+
"he": "1.2.0",
6162
"tslib": "^2.0.0"
6263
},
6364
"devDependencies": {
6465
"@aws-sdk/client-documentation-generator": "3.15.0",
66+
"@types/he": "1.1.1",
6567
"@types/node": "^12.7.5",
6668
"downlevel-dts": "0.7.0",
6769
"jest": "^26.1.0",

clients/client-docdb/protocols/Aws_query.ts

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -296,6 +296,7 @@ import {
296296
SerdeContext as __SerdeContext,
297297
} from "@aws-sdk/types";
298298
import { parse as xmlParse } from "fast-xml-parser";
299+
import { decode as heDecode } from "he";
299300

300301
export const serializeAws_queryAddTagsToResourceCommand = async (
301302
input: AddTagsToResourceCommandInput,
@@ -8697,14 +8698,6 @@ const buildHttpRpcRequest = async (
86978698
return new __HttpRequest(contents);
86988699
};
86998700

8700-
const decodeEscapedXML = (str: string) =>
8701-
str
8702-
.replace(/&amp;/g, "&")
8703-
.replace(/&apos;/g, "'")
8704-
.replace(/&quot;/g, '"')
8705-
.replace(/&gt;/g, ">")
8706-
.replace(/&lt;/g, "<");
8707-
87088701
const parseBody = (streamBody: any, context: __SerdeContext): any =>
87098702
collectBodyString(streamBody, context).then((encoded) => {
87108703
if (encoded.length) {
@@ -8713,7 +8706,7 @@ const parseBody = (streamBody: any, context: __SerdeContext): any =>
87138706
ignoreAttributes: false,
87148707
parseNodeValue: false,
87158708
trimValues: false,
8716-
tagValueProcessor: (val, tagName) => (val.trim() === "" ? "" : decodeEscapedXML(val)),
8709+
tagValueProcessor: (val, tagName) => (val.trim() === "" ? "" : heDecode(val)),
87178710
});
87188711
const textNodeName = "#text";
87198712
const key = Object.keys(parsedObj)[0];

clients/client-ec2/package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,13 @@
5858
"@aws-sdk/util-utf8-node": "3.13.1",
5959
"@aws-sdk/util-waiter": "3.15.0",
6060
"fast-xml-parser": "3.19.0",
61+
"he": "1.2.0",
6162
"tslib": "^2.0.0",
6263
"uuid": "^8.3.2"
6364
},
6465
"devDependencies": {
6566
"@aws-sdk/client-documentation-generator": "3.15.0",
67+
"@types/he": "1.1.1",
6668
"@types/node": "^12.7.5",
6769
"@types/uuid": "^8.3.0",
6870
"downlevel-dts": "0.7.0",

clients/client-ec2/protocols/Aws_ec2.ts

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2897,6 +2897,7 @@ import {
28972897
SerdeContext as __SerdeContext,
28982898
} from "@aws-sdk/types";
28992899
import { parse as xmlParse } from "fast-xml-parser";
2900+
import { decode as heDecode } from "he";
29002901
import { v4 as generateIdempotencyToken } from "uuid";
29012902

29022903
export const serializeAws_ec2AcceptReservedInstancesExchangeQuoteCommand = async (
@@ -71681,14 +71682,6 @@ const buildHttpRpcRequest = async (
7168171682
return new __HttpRequest(contents);
7168271683
};
7168371684

71684-
const decodeEscapedXML = (str: string) =>
71685-
str
71686-
.replace(/&amp;/g, "&")
71687-
.replace(/&apos;/g, "'")
71688-
.replace(/&quot;/g, '"')
71689-
.replace(/&gt;/g, ">")
71690-
.replace(/&lt;/g, "<");
71691-
7169271685
const parseBody = (streamBody: any, context: __SerdeContext): any =>
7169371686
collectBodyString(streamBody, context).then((encoded) => {
7169471687
if (encoded.length) {
@@ -71697,7 +71690,7 @@ const parseBody = (streamBody: any, context: __SerdeContext): any =>
7169771690
ignoreAttributes: false,
7169871691
parseNodeValue: false,
7169971692
trimValues: false,
71700-
tagValueProcessor: (val, tagName) => (val.trim() === "" ? "" : decodeEscapedXML(val)),
71693+
tagValueProcessor: (val, tagName) => (val.trim() === "" ? "" : heDecode(val)),
7170171694
});
7170271695
const textNodeName = "#text";
7170371696
const key = Object.keys(parsedObj)[0];

clients/client-elastic-beanstalk/package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,12 @@
5757
"@aws-sdk/util-utf8-node": "3.13.1",
5858
"@aws-sdk/util-waiter": "3.15.0",
5959
"fast-xml-parser": "3.19.0",
60+
"he": "1.2.0",
6061
"tslib": "^2.0.0"
6162
},
6263
"devDependencies": {
6364
"@aws-sdk/client-documentation-generator": "3.15.0",
65+
"@types/he": "1.1.1",
6466
"@types/node": "^12.7.5",
6567
"downlevel-dts": "0.7.0",
6668
"jest": "^26.1.0",

clients/client-elastic-beanstalk/protocols/Aws_query.ts

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -326,6 +326,7 @@ import {
326326
SerdeContext as __SerdeContext,
327327
} from "@aws-sdk/types";
328328
import { parse as xmlParse } from "fast-xml-parser";
329+
import { decode as heDecode } from "he";
329330

330331
export const serializeAws_queryAbortEnvironmentUpdateCommand = async (
331332
input: AbortEnvironmentUpdateCommandInput,
@@ -8194,14 +8195,6 @@ const buildHttpRpcRequest = async (
81948195
return new __HttpRequest(contents);
81958196
};
81968197

8197-
const decodeEscapedXML = (str: string) =>
8198-
str
8199-
.replace(/&amp;/g, "&")
8200-
.replace(/&apos;/g, "'")
8201-
.replace(/&quot;/g, '"')
8202-
.replace(/&gt;/g, ">")
8203-
.replace(/&lt;/g, "<");
8204-
82058198
const parseBody = (streamBody: any, context: __SerdeContext): any =>
82068199
collectBodyString(streamBody, context).then((encoded) => {
82078200
if (encoded.length) {
@@ -8210,7 +8203,7 @@ const parseBody = (streamBody: any, context: __SerdeContext): any =>
82108203
ignoreAttributes: false,
82118204
parseNodeValue: false,
82128205
trimValues: false,
8213-
tagValueProcessor: (val, tagName) => (val.trim() === "" ? "" : decodeEscapedXML(val)),
8206+
tagValueProcessor: (val, tagName) => (val.trim() === "" ? "" : heDecode(val)),
82148207
});
82158208
const textNodeName = "#text";
82168209
const key = Object.keys(parsedObj)[0];

clients/client-elastic-load-balancing-v2/package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,12 @@
5656
"@aws-sdk/util-utf8-browser": "3.13.1",
5757
"@aws-sdk/util-utf8-node": "3.13.1",
5858
"fast-xml-parser": "3.19.0",
59+
"he": "1.2.0",
5960
"tslib": "^2.0.0"
6061
},
6162
"devDependencies": {
6263
"@aws-sdk/client-documentation-generator": "3.15.0",
64+
"@types/he": "1.1.1",
6365
"@types/node": "^12.7.5",
6466
"downlevel-dts": "0.7.0",
6567
"jest": "^26.1.0",

0 commit comments

Comments
 (0)