Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(clients): call decode from HTML entities in XML parser #2381

Merged
merged 9 commits into from
May 14, 2021

Conversation

trivikr
Copy link
Member

@trivikr trivikr commented May 11, 2021

Issue

Fixes: #2362
Fixes: #2375

Description

Calls decode from HTML entities in XML parser

Testing

Integration tests are successful:

$ yarn test:integration-legacy
yarn run v1.22.10
$ cucumber-js --fail-fast
...............................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................

150 scenarios (150 passed)
523 steps (523 passed)
1m31.147s
Done in 95.67s.

$ yarn test:integration

 PASS  clients/client-transcribe-streaming/test/index.integ.spec.ts (31.622 s)
  TranscribeStream client
    ✓ should stream the transcript (28892 ms)

Test Suites: 1 passed, 1 total
Tests:       1 passed, 1 total
Snapshots:   0 total
Time:        32.091 s
Ran all test suites.
Done in 32.73s.

SQS message accepts carriage return:

Code
import { SQS } from "../aws-sdk-js-v3/clients/client-sqs/dist/cjs/index.js";
import md5 from "md5";

const region = "us-west-2";
const client = new SQS({ region });

const QueueName = `test-${Date.now()}`;
const { QueueUrl } = await client.createQueue({ QueueName });

const MessageBody = `hello\r\nworld`;
console.log(MessageBody);
const { MD5OfMessageBody } = await client.sendMessage({
  MessageBody,
  QueueUrl,
});

console.log(
  `\nmd5 check for sent message: ${md5(MessageBody) === MD5OfMessageBody}`
);

const response = await client.receiveMessage({ QueueUrl });
console.log(
  `md5 check for received message: ${
    md5(MessageBody) === md5(response.Messages[0].Body)
  }`
);
console.log(
  `\nStrict Equality Comparison: ${MessageBody === response.Messages[0].Body}`
);

console.log(response.Messages[0].Body);

await client.deleteQueue({ QueueUrl });
Output
hello
world

md5 check for sent message: true
md5 check for received message: true

Strict Equality Comparison: true
hello
world

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@codecov-commenter
Copy link

codecov-commenter commented May 11, 2021

Codecov Report

❗ No coverage uploaded for pull request base (main@3cf3b32). Click here to learn what that means.
The diff coverage is n/a.

❗ Current head 90ef3f8 differs from pull request most recent head bab0069. Consider uploading reports for the commit bab0069 to get more accurate results
Impacted file tree graph

@@           Coverage Diff           @@
##             main    #2381   +/-   ##
=======================================
  Coverage        ?   58.91%           
=======================================
  Files           ?      483           
  Lines           ?    26000           
  Branches        ?     6170           
=======================================
  Hits            ?    15318           
  Misses          ?    10682           
  Partials        ?        0           

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 3cf3b32...bab0069. Read the comment docs.

Copy link
Contributor

@AllanZhengYP AllanZhengYP left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approve with caveat that we need to audit the client size, as well as possibility of vendoring this dependency later.

@trivikr trivikr merged commit fd6b7eb into aws:main May 14, 2021
@trivikr trivikr deleted the use-html-entity-encoder-decoder branch May 14, 2021 18:26
@github-actions
Copy link

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs and link to relevant comments in this thread.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 29, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
4 participants