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

proposal: net/url: not escaping # in url.URL.String() #64306

Closed
Andrew-M-C opened this issue Nov 21, 2023 · 3 comments
Closed

proposal: net/url: not escaping # in url.URL.String() #64306

Andrew-M-C opened this issue Nov 21, 2023 · 3 comments
Labels
Milestone

Comments

@Andrew-M-C
Copy link

By url.URL's String() method, special characters will be escaped into %xx format.
However, as SPA URL use # as a routing hash identifier, # should not be escaped.

Playground

Is it possible to provide another method to encode URL without escaping # in path field?

@gopherbot gopherbot added this to the Proposal milestone Nov 21, 2023
@seankhliao
Copy link
Member

that's not a path, that's a fragment / hash

@seankhliao seankhliao closed this as not planned Won't fix, can't repro, duplicate, stale Nov 21, 2023
@mvdan
Copy link
Member

mvdan commented Nov 21, 2023

@seankhliao note that per the playground link above, the first hash character is parsed as part of the path.

@seankhliao
Copy link
Member

yes, but it uses ParseRequestURI, which assumes a stripped fragment. it has to be escaped to preserve the semantics in a general url string

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

4 participants