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

Change to handling encoded parameters in 7.0.2 #75

Open
shank-eric opened this issue May 22, 2024 · 5 comments
Open

Change to handling encoded parameters in 7.0.2 #75

shank-eric opened this issue May 22, 2024 · 5 comments
Labels

Comments

@shank-eric
Copy link

shank-eric commented May 22, 2024

Hello!

I recently upgraded from 7.0.1 to 7.0.2 and had a test fail due to a change in how encoded URL parameters are handled. For example, with 7.0.1 when I pass a URL like http://test.com?encodedParam=foo%2Fbar%2Fbaz into sanitizeUrl I get back http://test.com?encodedParam=foo%2Fbar%2Fbaz.

But with 7.0.2 when passing the same URL in, I now get back http://test.com?encodedParam=foo/bar/baz. I've created a little sample code sandbox here: https://codesandbox.io/p/sandbox/little-butterfly-4n6xzp?file=%2Fpackage.json%3A10%2C38. You can see the change in behavior by switching the version in the package.json in that sandbox.

I've reverted to 7.0.1 for now, but Is this an intended change?

@animeshk874
Copy link

I've been facing something similar too. Might be related to this change here - 6c15df9

petersutter added a commit to gardener/dashboard that referenced this issue Jul 11, 2024
petersutter added a commit to gardener/dashboard that referenced this issue Jul 12, 2024
* pin @braintree/sanitize-url to 7.0.1

this works around issue braintree/sanitize-url#75

* clone newIssue frontend config before mutating it
petersutter added a commit to petersutter/dashboard that referenced this issue Jul 12, 2024
petersutter added a commit to petersutter/dashboard that referenced this issue Jul 12, 2024
petersutter added a commit to petersutter/dashboard that referenced this issue Jul 12, 2024
petersutter added a commit to gardener/dashboard that referenced this issue Jul 12, 2024
… Ticket link (#1976)

* pin @braintree/sanitize-url to 7.0.1

this works around issue braintree/sanitize-url#75

* clone newIssue frontend config before mutating it
@ibooker
Copy link
Contributor

ibooker commented Aug 7, 2024

Hello,
Thanks for reporting this issue. We'll take a look.

(internal tracking BTWEB-173)

@ibooker ibooker added the triaged label Aug 7, 2024
@M0ns1gn0r
Copy link

I am experiencing the same issue. I see 7.1.0 was released without fixing this breaking change.

@jviolas
Copy link

jviolas commented Oct 11, 2024

I have the same issue with some URI encoded characters (especially for + as %2B and % as %25). And it's not only query parameter, it affects also the path of the url. If you put https://example.com/path/with/100%25.png, it will output https://example.com/path/with/100%.png which is not uri encoded, and will fail if passed to decodeURI() because there is a % without a hexacode behind it.
This behavior has changed since #73 because now the input url goes through decodeURIComponent() but are not re-encoded after. Only some of them are when using URL.toString() at the end.

@eunicocornelius
Copy link

+1 to this, I am also facing this same issue, in 7.1.0. It would be great to have an additional parameter to choose whether to decode the URL or not instead like sanitizeURL(url, decode=true/false)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

6 participants