Chrome Version: 68
OS: All
What steps will reproduce the problem?
From JS console:
> new URL("http://example.com/foo bar").href
> new URL("fhqwhgads://example.com/foo bar").href
What is the expected result?
> new URL("http://example.com/foo bar").href
"http://example.com/foo%20bar"
> new URL("fhqwhgads://example.com/foo bar").href
"fhqwhgads://example.com/foo%20bar"
What happens instead?
> new URL("http://example.com/foo bar").href
"http://example.com/foo%20bar"
> new URL("fhqwhgads://example.com/foo bar").href
"fhqwhgads://example.com/foo bar"
The expected behaviour is seen in Firefox, and by spec: https://url.spec.whatwg.org/#path-state the path state doesn't treat non-special URLs any differently other than not treating '\' as a path separator. It uses the same percent encode set.
Note: In fact all of the other path-percent-encode-set characters ("<>`{}) also do not encode correctly in Chrome, but also don't encode in Firefox, so it's less clear cut that the spec is correct in this case.
Apparently this affects GURL as well ( https://crbug.com/847039#c52 ).
Comment 1 by ricea@chromium.org
, Jul 30