Skip to content

Commit

Permalink
url: Needs to ignore repeated slashes in file URL
Browse files Browse the repository at this point in the history
  • Loading branch information
watilde committed Feb 5, 2017
1 parent 8b04bc9 commit 247f960
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
16 changes: 11 additions & 5 deletions src/node_url.cc
Original file line number Diff line number Diff line change
Expand Up @@ -731,13 +731,15 @@ namespace url {
if (has_state_override)
goto done;
buffer.clear();
if (url.scheme == "file:") {
state = kFile;
} else if (special &&
if (special &&
has_base &&
DOES_HAVE_SCHEME(base) &&
url.scheme == base.scheme) {
state = kSpecialRelativeOrAuthority;
if (url.scheme == "file:") {
state = kFile;
} else {
state = kSpecialRelativeOrAuthority;
}
} else if (special) {
state = kSpecialAuthoritySlashes;
} else if (p[1] == '/') {
Expand Down Expand Up @@ -950,7 +952,11 @@ namespace url {
break;
case kSpecialAuthorityIgnoreSlashes:
if (ch != '/' && ch != '\\') {
state = kAuthority;
if (url.scheme == "file:") {
state = kFile;
} else {
state = kAuthority;
}
continue;
}
break;
Expand Down
4 changes: 4 additions & 0 deletions test/fixtures/url-tests-additional.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,5 +83,9 @@ module.exports = [
'url': 'tag:joe@example.org,2001:foo/bar',
'protocol': 'tag:',
'pathname': 'joe@example.org,2001:foo/bar'
},
{
'url': 'file://////foo/bar',
'href': 'file:///foo/bar'
}
];

0 comments on commit 247f960

Please sign in to comment.