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

net/url: QueryEscape escapes its own escape characters #56503

Closed
UndeadBaneGitHub opened this issue Oct 31, 2022 · 3 comments
Closed

net/url: QueryEscape escapes its own escape characters #56503

UndeadBaneGitHub opened this issue Oct 31, 2022 · 3 comments

Comments

@UndeadBaneGitHub
Copy link

What version of Go are you using (go version)?

$ go version
go1.19.2

But really, affects 1.18 and other versions too

Does this issue reproduce with the latest release?

Yes

What operating system and processor architecture are you using (go env)?

It's universal anywhere, since it's a bug in logic implementation of internal shouldEscape method

What did you do?

Playground link: https://go.dev/play/p/WXXx4EiSy_E

What did you expect to see?

Already escaped string should not be escaped again (example behavior: Javascript encodeURIComponent method and similar)

What did you see instead?

It gets escaped as many times as the method is called.

@seankhliao
Copy link
Member

The + sign carries semantic meaning within url query escaping, in general it won't be possible to know if it has been escaped before.

Closing as working as intended.

@seankhliao seankhliao closed this as not planned Won't fix, can't repro, duplicate, stale Nov 1, 2022
@UndeadBaneGitHub
Copy link
Author

UndeadBaneGitHub commented Nov 1, 2022

@seankhliao It also escapes % sign as shown in the playground, it is not working as intended.

@ianlancetaylor
Copy link
Contributor

The JavaScript encodeURIComponent function also escapes a % character in its input string, encoding it as %25.

We aren't going to make any changes here.

@golang golang locked and limited conversation to collaborators Nov 1, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants