mirror of
https://github.com/nodejs/node.git
synced 2026-11-27 17:52:27 -05:00
url: restrict setting protocol to "file"
Since file URLs can not have `username/password/port`, the specification was updated to restrict setting protocol to "file". Refs: https://github.com/whatwg/url/pull/269 Fixes: https://github.com/nodejs/node/issues/11785 PR-URL: https://github.com/nodejs/node/pull/11887 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Timothy Gu <timothygu99@gmail.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
This commit is contained in:
1 parent
8ab26cf508
commit
c51d925c84
1 file changed
+7
@@ -122,6 +122,13 @@ function onParseProtocolComplete(flags, protocol, username, password,
|
||||
if ((s && !newIsSpecial) || (!s && newIsSpecial)) {
|
||||
return;
|
||||
}
|
||||
if (protocol === 'file:' &&
|
||||
(ctx.username || ctx.password || ctx.port !== undefined)) {
|
||||
return;
|
||||
}
|
||||
if (ctx.scheme === 'file:' && !ctx.host) {
|
||||
return;
|
||||
}
|
||||
if (newIsSpecial) {
|
||||
ctx.flags |= binding.URL_FLAGS_SPECIAL;
|
||||
} else {
|
||||
|
||||
Reference in new issue
Block a user