net/url: paths parsed with a literal space don't properly stringify in a raw way, losing information #38292
Labels
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?
There are certain cases where maintaining whether a character is encoded or not is of utmost importance (for instance, wildcards when referencing object storage solutions).
If a URL has a space in it when parsed, it will succeed at parsing, but it will choose to return the literal path re-encoded, rather than the raw path. (unexpected behavior)
If a URL is completely safely encoded, it will succeed at parsing, and then it will choose to return the raw path. (expected behavior)
Sample below, demonstrating both cases:
https://play.golang.org/p/IeAIos8Wbx-
What did you expect to see?
I expected the complete raw path when stringifying if it's roughly equivalent (in both cases here, it is roughly equivalent).
What did you see instead?
Instead, I got back a encoded literal path, causing a loss of information.
The text was updated successfully, but these errors were encountered: