Skip to content

Commit 72da362

Browse files
watildeitaloacasas
authored andcommitted
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: #11123 Fixes: #10978 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Joyee Cheung <[email protected]>
1 parent 12cf359 commit 72da362

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/node_url.cc

+5-3
Original file line numberDiff line numberDiff line change
@@ -1074,8 +1074,10 @@ namespace url {
10741074
SET_HAVE_QUERY()
10751075
url.query = base.query;
10761076
}
1077+
break;
10771078
}
1078-
break;
1079+
state = kPath;
1080+
continue;
10791081
case '\\':
10801082
case '/':
10811083
state = kFileSlash;
@@ -1092,8 +1094,8 @@ namespace url {
10921094
}
10931095
SET_HAVE_QUERY()
10941096
state = kQuery;
1097+
break;
10951098
}
1096-
break;
10971099
case '#':
10981100
if (base_is_file) {
10991101
if (DOES_HAVE_HOST(base)) {
@@ -1109,8 +1111,8 @@ namespace url {
11091111
url.query = base.query;
11101112
}
11111113
state = kFragment;
1114+
break;
11121115
}
1113-
break;
11141116
default:
11151117
if (base_is_file &&
11161118
(!WINDOWS_DRIVE_LETTER(ch, p[1]) ||

0 commit comments

Comments
 (0)