mirror of
https://github.com/nodejs/node.git
synced 2026-11-27 17:52:27 -05:00
url: fix file state clarification in binding
An empty file URL `file:` should be parsed to `file:///` instead of `file://`. In the `kFile` state, the process was braked immediately when the ch is EOL, but it should work as `default` in the kFile state to adjust slashes. Applicable cases: * `file:#foo` => `file:///#foo` * `file:?bar` => `file:///?bar` PR-URL: https://github.com/nodejs/node/pull/11123 Fixes: https://github.com/nodejs/node/issues/10978 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
This commit is contained in:
1 parent
12cf359423
commit
72da362d6e
1 file changed
+5
-3
+5
-3
@@ -1074,8 +1074,10 @@ namespace url {
|
||||
SET_HAVE_QUERY()
|
||||
url.query = base.query;
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
state = kPath;
|
||||
continue;
|
||||
case '\\':
|
||||
case '/':
|
||||
state = kFileSlash;
|
||||
@@ -1092,8 +1094,8 @@ namespace url {
|
||||
}
|
||||
SET_HAVE_QUERY()
|
||||
state = kQuery;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case '#':
|
||||
if (base_is_file) {
|
||||
if (DOES_HAVE_HOST(base)) {
|
||||
@@ -1109,8 +1111,8 @@ namespace url {
|
||||
url.query = base.query;
|
||||
}
|
||||
state = kFragment;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
if (base_is_file &&
|
||||
(!WINDOWS_DRIVE_LETTER(ch, p[1]) ||
|
||||
|
||||
Reference in new issue
Block a user