-
Notifications
You must be signed in to change notification settings - Fork 7.3k
url resolve(href, '.') sometimes leaves off trailing slash #8992
Comments
I'm not sure if this is a bug or not. |
"http://www.example.com" and "http://www.example.com/" represent the exact same thing: the root in the domain. This is something else. I found the following comment and code in the same file you pointed to:
I'm sure the "bug" is in that test for the host in "." and ".." are directory specs, "/path/to/" is a directory spec, but "/path/to" is not. Hence, the trailing slash should always be there. |
You are right. Actually I managed to solve the problem on my machine. I'll send a pull request. |
'.' and '..' are directory specs and resloving urls with or without the hostname with '.' and '..' should add a trailing slash to the end of the url. Fix nodejs#8992
'.' and '..' are directory specs and resolving urls with or without the hostname with '.' and '..' should add a trailing slash to the end of the url. Fix nodejs#8992
Fixed by ad06848. |
'.' and '..' are directory specs and resolving urls with or without the hostname with '.' and '..' should add a trailing slash to the end of the url. Fixes: nodejs/node-v0.x-archive#8992 PR-URL: #278 Reviewed-By: Trevor Norris <trev.norris@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
'.' and '..' are directory specs and resolving urls with or without the hostname with '.' and '..' should add a trailing slash to the end of the url. Fixes: nodejs#8992 PR-URL: nodejs#9010 Reviewed-by: Trevor Norris <trev.norris@gmail.com>
'.' and '..' are directory specs and resolving urls with or without the hostname with '.' and '..' should add a trailing slash to the end of the url. Fixes nodejs#8992.
Just for the record, this actually landed for good in 9b534e2. |
The following script:
produces the following output:
which is: resolving '.' produces a result that contains a trailing slash if the base url is absolute including host, but leaves it off if there is no host name (AKA "relative to the domain root").
These are very different urls both for a webserver and as a base url for a browser.
On every browser I have tested, using the following html
the href of the test link also always includes the slash.
Tested with v0.10.35
The text was updated successfully, but these errors were encountered: