net/url: URL.String() double encodes path #31835
Labels
FrozenDueToAge
NeedsInvestigation
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes.
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
https://play.golang.org/p/SFl-9urTdRL
What did you expect to see?
(
%2F
)What did you see instead?
(
%252F
)I have to build an URL that contains both slashes and encoded slashes, because I'm using the GitLab API:
But when I call
URL.String()
, the path is escaped again. I read that this is intended behavior:However, there seems to be no way to convert the URL to a string without automatically escaping the path. I think this should be an option for the
URL.String()
method, or there should be anURL.RawString()
method of some kind.Related: #25208, #10887
The text was updated successfully, but these errors were encountered: