Skip to content

Commit 1e2f500

Browse files
committed
feat: handle Windows file paths with backslashes in URL parsing
1 parent 59979a1 commit 1e2f500

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

url.bs

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -544,7 +544,7 @@ U+005F (_).
544544
</ol>
545545

546546
<p class=note>Of the possible values for the <var>percentEncodeSet</var> argument only two end up
547-
encoding U+0025 (%) and thus give roundtripable data: <a>component percent-encode set</a> and
547+
encoding U+0025 (%) and thus give "roundtripable data": <a>component percent-encode set</a> and
548548
<a><code>application/x-www-form-urlencoded</code> percent-encode set</a>. The other values for the
549549
<var>percentEncodeSet</var> argument — which happen to be used by the <a>URL parser</a> — leave
550550
U+0025 (%) untouched and as such it needs to be
@@ -2247,8 +2247,19 @@ and then runs these steps:
22472247
<li><p>If <a>c</a> is an <a>ASCII alphanumeric</a>, U+002B (+), U+002D (-), or U+002E (.),
22482248
append <a>c</a>, <a lt="ASCII lowercase">lowercased</a>, to <var>buffer</var>.
22492249

2250-
<li>
2251-
<p>Otherwise, if <a>c</a> is U+003A (:), then:
2250+
<li>
2251+
<p>Otherwise, if <a>c</a> is U+003A (:) and <var>buffer</var>'s <a for=string>length</a> is 1 and <var>buffer</var>'s first <a for=/>code point</a> is an <a>ASCII alpha</a> and <a>remaining</a> starts with U+005C (\), then:
2252+
2253+
<ol>
2254+
<li><p>Set <var>url</var>'s <a for=url>scheme</a> to "<code>file</code>".
2255+
<li><p>Set <var>buffer</var> to the empty string.
2256+
<li><p>Replace the first <a for=/>code point</a> in <a>remaining</a> (U+005C (\)) with U+002F (/).
2257+
<li><p>If <a>remaining</a> does not start with "<code>//</code>", <a>special-scheme-missing-following-solidus</a> <a>validation error</a>.
2258+
<li><p>Set <var>state</var> to <a>file state</a>.
2259+
</ol>
2260+
2261+
<li>
2262+
<p>Otherwise, if <a>c</a> is U+003A (:), then:
22522263

22532264
<ol>
22542265
<li>

0 commit comments

Comments
 (0)