From 91bcea44658a9f001db264616072bcbb442784e4 Mon Sep 17 00:00:00 2001 From: Anne van Kesteren Date: Wed, 22 Mar 2017 11:31:00 +0100 Subject: [PATCH] URL: trim leading slashes of file URL paths Also copy file URL hosts correctly for path-absolute input. Tests: https://github.com/w3c/web-platform-tests/pull/5195. Closes #234 by superseding it. Fixes #232. --- url.bs | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/url.bs b/url.bs index b8e65bcb..d1786b51 100644 --- a/url.bs +++ b/url.bs @@ -1909,14 +1909,22 @@ string input, optionally with a base URL base, opti
  1. -

    If base is non-null, base's scheme is - "file", and base's path[0] is a - normalized Windows drive letter, append base's - path[0] to url's path. +

    If base is non-null and base's scheme is + "file", then: -

    This is a (platform-independent) Windows drive letter quirk. Both - url's and base's host are null under - these conditions and therefore not copied. +

      +
    1. +

      If base's path[0] is a + normalized Windows drive letter, then append base's + path[0] to url's path. + +

      This is a (platform-independent) Windows drive letter quirk. Both + url's and base's host are null under these conditions + and therefore not copied. + +

    2. Otherwise, set url's host to base's + host. +

  2. Set state to path state, and decrease pointer by one. @@ -2057,6 +2065,12 @@ string input, optionally with a base URL base, opti

  3. Set buffer to the empty string. +

  4. If url's scheme is "file" and c is the + EOF code point, U+003F (?), or U+0023 (#), then while url's + path's size is greater than 1 and url's + path[0] is the empty string, validation error, remove + the first item from url's path. +

  5. If c is U+003F (?), then set url's query to the empty string and state to query state.