Skip to content

Commit

Permalink
Repeated slashes should be ignored in file scheme
Browse files Browse the repository at this point in the history
Repeated slashes should be ignored in not only the http scheme, but
also the file scheme as well.

Tests: web-platform-tests/wpt#4762

Fixes: whatwg#232
  • Loading branch information
watilde committed Feb 8, 2017
1 parent ac6489f commit f320178
Showing 1 changed file with 41 additions and 18 deletions.
59 changes: 41 additions & 18 deletions url.bs
Original file line number Diff line number Diff line change
Expand Up @@ -1358,21 +1358,22 @@ string <var>input</var>, optionally with a <a>base URL</a> <var>base</var>, opti
<li><p>If <var>state override</var> is given, terminate this algorithm.

<li>
<p>If <var>url</var>'s <a for=url>scheme</a> is "<code>file</code>", run these
subsubsteps:

<p>Otherwise, if <var>url</var> <a>is special</a>, <var>base</var> is non-null, and
<var>base</var>'s <a for=url>scheme</a> is equal to <var>url</var>'s
<a for=url>scheme</a>, run these subsubsteps:</p>
<ol>
<li><p>If <a>remaining</a> does not start with "<code>//</code>",
<a>syntax violation</a>.

<li><p>Set <var>state</var> to <a>file state</a>.
<li>
<p>If <var>url</var>'s <a for=url>scheme</a> is "<code>file</code>", run these
subsubsteps:</p>
<ol>
<li><p>If <a>remaining</a> does not start with "<code>//</code>",
<a>syntax violation</a>.</p></li>
<li><p>Set <var>state</var> to <a>file state</a>.</p></li>
</ol>
<li>
<p>Otherwise, set <var>state</var> to <a>special relative or authority state</a>.</p>
</li>
</ol>

<li>
<p>Otherwise, if <var>url</var> <a>is special</a>, <var>base</var> is non-null, and
<var>base</var>'s <a for=url>scheme</a> is equal to <var>url</var>'s <a for=url>scheme</a>,
set <var>state</var> to <a>special relative or authority state</a>.

<p class="note no-backref">This means that <var>base</var>'s
<a for=url>cannot-be-a-base-URL flag</a> is unset.

Expand Down Expand Up @@ -1561,11 +1562,33 @@ string <var>input</var>, optionally with a <a>base URL</a> <var>base</var>, opti

<dt><dfn>special authority ignore slashes state</dfn>
<dd>
<p>If <a>c</a> is neither "<code>/</code>" nor "<code>\</code>", set <var>state</var>
to <a>authority state</a>, and decrease <var>pointer</var> by one.

<p>Otherwise, <a>syntax violation</a>.

<ol>
<li>
<p>If <a>c</a> is neither "<code>/</code>" nor "<code>\</code>", run these substeps:
<ol>
<li>
<p>If <var>url</var>'s <a for=url>scheme</a> is "<code>file</code>", run these
subsubsteps:
<ol>
<li>
<p>If <a>remaining</a> does not start with "<code>//</code>",
<a>syntax violation</a>.</p>
</li>
<li>
<p>Set <var>state</var> to <a>file state</a>,
and decrease <var>pointer</var> by one.</p>
</li>
</ol>
<li>
<p>Otherwise, set <var>state</var>
to <a>authority state</a>, and decrease <var>pointer</var> by one.</p>
</li>
</ol>
<li>
<p>Otherwise, <a>syntax violation</a>.</p>
</li>
</ol>
</dd>
<dt><dfn>authority state</dfn>
<dd>
<ol>
Expand Down

0 comments on commit f320178

Please # to comment.