partially decoded special chars in query params
Closed this issue · 7 comments
georgecrawford commented
'https://example.com?tint=%23505050,%23505050'
is normalised to 'https://example.com/?tint=%23505050,#505050'
. Note that only one of the entities is decoded. I'm not even sure that the entities should be decoded here - what's the justification for that?
sindresorhus commented
Would you mind adding a failing test?
georgecrawford commented
Gladly. But could you explain what you'd prefer to see? Both %23
s transformed to #
, or neither?
sindresorhus commented
georgecrawford commented
Uh-oh:
$ node
> url = {search:'foo=#505050,#505050'}
{ search: 'foo=#505050,#505050' }
> require('url').format(url)
'?foo=%23505050,#505050'
Do you think this is a Node bug? Seems to affect Node 4, 5 and 6.
georgecrawford commented
sindresorhus commented
Yes, looks like a Node.js bug. Can you open an issue over at the Node.js issue tracker and paste a link to it here?
ben-eb commented
Looks like it's fixed! Using v4.7.0
:
$ node
> url = {search:'foo=#505050,#505050'}
{ search: 'foo=#505050,#505050' }
> require('url').format(url)
'?foo=%23505050,%23505050'