Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
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: whatwg/url#269
Fixes: #11785
  • Loading branch information
watilde committed Mar 18, 2017
commit 9d4d73ffa9ac1b6d4fc288d09ddb9046630c1e40
7 changes: 7 additions & 0 deletions lib/internal/url.js
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,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 {
Expand Down