From f3201783519e511e88e98386301a8f5430bf0972 Mon Sep 17 00:00:00 2001 From: Daijiro Wachi Date: Wed, 8 Feb 2017 18:54:13 +0100 Subject: [PATCH] Repeated slashes should be ignored in file scheme Repeated slashes should be ignored in not only the http scheme, but also the file scheme as well. Tests: https://github.com/w3c/web-platform-tests/pull/4762 Fixes: https://github.com/whatwg/url/issues/232 --- url.bs | 59 ++++++++++++++++++++++++++++++++++++++++------------------ 1 file changed, 41 insertions(+), 18 deletions(-) diff --git a/url.bs b/url.bs index b54475fa..736f505b 100644 --- a/url.bs +++ b/url.bs @@ -1358,21 +1358,22 @@ string input, optionally with a base URL base, opti
  • If state override is given, terminate this algorithm.

  • -

    If url's scheme is "file", run these - subsubsteps: - +

    Otherwise, if url is special, base is non-null, and + base's scheme is equal to url's + scheme, run these subsubsteps:

      -
    1. If remaining does not start with "//", - syntax violation. - -

    2. Set state to file state. +

    3. +

      If url's scheme is "file", run these + subsubsteps:

      +
        +
      1. If remaining does not start with "//", + syntax violation.

      2. +
      3. Set state to file state.

      4. +
      +
    4. +

      Otherwise, set state to special relative or authority state.

      +
    - -
  • -

    Otherwise, if url is special, base is non-null, and - base's scheme is equal to url's scheme, - set state to special relative or authority state. -

    This means that base's cannot-be-a-base-URL flag is unset. @@ -1561,11 +1562,33 @@ string input, optionally with a base URL base, opti

    special authority ignore slashes state
    -

    If c is neither "/" nor "\", set state - to authority state, and decrease pointer by one. - -

    Otherwise, syntax violation. - +

      +
    1. +

      If c is neither "/" nor "\", run these substeps: +

        +
      1. +

        If url's scheme is "file", run these + subsubsteps: +

          +
        1. +

          If remaining does not start with "//", + syntax violation.

          +
        2. +
        3. +

          Set state to file state, + and decrease pointer by one.

          +
        4. +
        +
      2. +

        Otherwise, set state + to authority state, and decrease pointer by one.

        +
      3. +
      +
    2. +

      Otherwise, syntax violation.

      +
    3. +
    +
    authority state