-
Notifications
You must be signed in to change notification settings - Fork 30k
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
url.format()
encodes '#' inconsistently
#8064
Comments
Yes, because at https://github.com/nodejs/node/blob/master/lib/url.js#L627 search = search.replace('#', '%23'); and
|
If all occurrences of search = search.replace(/#/g, '%23'); |
I'd be happy to submit a PR if someone can confirm that all occurrences of |
Looks like this has already been noticed: https://github.com/nodejs/node/pull/2303/files#diff-bbc5176adff1bbc01acd61bfc85d049fR973. I'm not sure what the status of the various URL improvements is. There seem to be some merges, reverts, and open PRs with conflicts. Any chance of getting a quick fix in for this? |
Right - I also don't know what's desired. I just see that a number of different PRs to refactor this code seem to add the |
Yes, hash-URIs are tricky. Anything After the First RFC3986 states that:
And formatting of fragment is context dependent:
So, encoding only the first |
But I'm explicitly setting this string as the |
/cc @jasnell |
Definitely a bug, in my opinion. I'll look at this a bit later today and see about getting a PR opened. |
(unless you want to go ahead with a PR @imyller :-) ..) |
I'll open PR soon. |
This commit fixes an error where only the first occurrence of `#` in `search` parameter is URL encoded, and subsequent occurrences are not. Also added a test for the case. Fixes: nodejs#8064 Signed-off-by: Ilkka Myller <[email protected]>
This commit fixes an error where only the first occurrence of `#` in `search` parameter is URL encoded, and subsequent occurrences are not. Also added a test for the case. Fixes: nodejs#8064 PR-URL: nodejs#8072 Reviewed-By: James M Snell <[email protected]> Conflicts: test/parallel/test-url.js
This commit fixes an error where only the first occurrence of `#` in `search` parameter is URL encoded, and subsequent occurrences are not. Also added a test for the case. Fixes: #8064 PR-URL: #8072 Reviewed-By: James M Snell <[email protected]> Conflicts: test/parallel/test-url.js
This commit fixes an error where only the first occurrence of `#` in `search` parameter is URL encoded, and subsequent occurrences are not. Also added a test for the case. Fixes: #8064 PR-URL: #8072 Reviewed-By: James M Snell <[email protected]>
the fix for this has been backported to v4.x-staging in 2069ba9 |
This commit fixes an error where only the first occurrence of `#` in `search` parameter is URL encoded, and subsequent occurrences are not. Also added a test for the case. Fixes: #8064 PR-URL: #8072 Reviewed-By: James M Snell <[email protected]>
This commit fixes an error where only the first occurrence of `#` in `search` parameter is URL encoded, and subsequent occurrences are not. Also added a test for the case. Fixes: #8064 PR-URL: #8072 Reviewed-By: James M Snell <[email protected]>
This commit fixes an error where only the first occurrence of `#` in `search` parameter is URL encoded, and subsequent occurrences are not. Also added a test for the case. Fixes: #8064 PR-URL: #8072 Reviewed-By: James M Snell <[email protected]>
This commit fixes an error where only the first occurrence of `#` in `search` parameter is URL encoded, and subsequent occurrences are not. Also added a test for the case. Fixes: #8064 PR-URL: #8072 Reviewed-By: James M Snell <[email protected]>
Version: affects at least Node 4.4.7, 5.7.1, 6.3.0
Platform: Darwin Kernel Version 15.5.0; root:xnu-3248.50.21~8/RELEASE_X86_64 x86_64
OS: Mac OS X 10.11.5
For a reason I can't understand, a
#
symbol in thesearch
parameter of a URL is formatted inconsistently. The first occurrence (whatever the position) seems to be url-encoded, and subsequent occurrences are not:This seems to affect Node 4-6 at least, in my testing. It's causing problems in sindresorhus/normalize-url#26.
The text was updated successfully, but these errors were encountered: