Skip to content

fix: use encodeURIComponent instead of encodeURI#1198

Merged
szmarczak merged 1 commit intomasterfrom
fix-urlcomponent
Oct 5, 2021
Merged

fix: use encodeURIComponent instead of encodeURI#1198
szmarczak merged 1 commit intomasterfrom
fix-urlcomponent

Conversation

@szmarczak
Copy link
Copy Markdown
Contributor

Fixes #1193

@szmarczak szmarczak requested a review from B4nan October 5, 2021 10:45
Comment thread src/utils_request.js
Comment on lines -257 to +258
const encoded = encodeURI(Buffer.from(chunks, 'hex').toString());
const encoded = encodeURIComponent(Buffer.from(chunks, 'hex').toString());
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

encodeURI doesn't encode /: %2F (input) → / (hex) → / (encodeURI)
encodeURIComponent does encode /: %2F (input) → / (hex) → %2F (encodeURIComponent)

We want the latter since we deal with percent encoded characters.

@szmarczak szmarczak merged commit cd98da0 into master Oct 5, 2021
@szmarczak szmarczak deleted the fix-urlcomponent branch October 5, 2021 11:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Not getting the full response body

1 participant