Skip to content

Commit

Permalink
Restrict protocol around "file"
Browse files Browse the repository at this point in the history
As file URLs cannot have username/password/port we don’t want to allow changing the scheme of a URL that contains one or more of those components.

Similarly a file URL can have an empty/null host, changing the scheme to another special URL that cannot have such a host would be bad.

Fixes #259 and fixes #270.
  • Loading branch information
annevk authored Mar 15, 2017
1 parent 5807b28 commit 462fdc1
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions url.bs
Original file line number Diff line number Diff line change
Expand Up @@ -1495,6 +1495,12 @@ string <var>input</var>, optionally with a <a>base URL</a> <var>base</var>, opti

<li><p>If <var>url</var>'s <a for=url>scheme</a> is not a <a>special scheme</a> and
<var>buffer</var> is, then return.

<li><p>If <var>url</var> <a>includes credentials</a> or has a non-null <a for=url>port</a>,
and <var>buffer</var> is "<code>file</code>", then return.

<li><p>If <var>url</var>'s <a for=url>scheme</a> is "<code>file</code>" and its
<a for=url>host</a> is an <a>empty host</a> or null, then return.
</ol>

<li><p>Set <var>url</var>'s <a for=url>scheme</a> to <var>buffer</var>.
Expand Down

0 comments on commit 462fdc1

Please sign in to comment.