From 758cac2b86a7b5d722a6c1f0449c0990773b696e Mon Sep 17 00:00:00 2001 From: Karl Wagner <5254025+karwa@users.noreply.github.com> Date: Thu, 7 Sep 2023 14:37:57 +0200 Subject: [PATCH] Escape trailing spaces in opaque paths --- url.bs | 39 ++++++++------------------------------- 1 file changed, 8 insertions(+), 31 deletions(-) diff --git a/url.bs b/url.bs index 0862519..ea96c89 100644 --- a/url.bs +++ b/url.bs @@ -2846,6 +2846,14 @@ and then runs these steps:
opaque path state
    +
  1. If c is U+003F (?), U+0023 (#), or the EOF code point: +

      +
    1. Let n be the number of U+0020 SPACE code points at the end of url's + path. +

    2. Replace the last n code points in url's path + with n repetitions of the string "%20". +

    +
  2. If c is U+003F (?), then set url's query to the empty string and state to query state. @@ -3352,21 +3360,6 @@ interface URL { object. -

    To potentially strip trailing spaces from an opaque path given a {{URL}} object -url: - -

      -
    1. If url's URL does not have an opaque path, then - return. - -

    2. If url's URL's fragment is non-null, then return. - -

    3. If url's URL's query is non-null, then return. - -

    4. Remove all trailing U+0020 SPACE code points from url's - URL's path. -

    -

    The API URL parser takes a scalar value string url and an optional null-or-scalar value string base (default null), and then runs these steps: @@ -3633,8 +3626,6 @@ one might have assumed the setter to always "reset" both.

  3. Empty this's query object's list. -

  4. Potentially strip trailing spaces from an opaque path with this. -

  5. Return.

@@ -3650,11 +3641,6 @@ one might have assumed the setter to always "reset" both. result of parsing input. -

The {{URL/search}} setter has the potential to remove trailing U+0020 SPACE -code points from this's URL's path. It does this -so that running the URL parser on the output of running the URL serializer on -this's URL does not yield a URL that is not equal. -

The searchParams getter steps are to return this's query object. @@ -3676,8 +3662,6 @@ so that running the URL parser on the output of running the URL serial

  1. Set this's URL's fragment to null. -

  2. Potentially strip trailing spaces from an opaque path with this. -

  3. Return.

@@ -3690,9 +3674,6 @@ so that running the URL parser on the output of running the URL serial state override. -

The {{URL/hash}} setter has the potential to change this's URL's -path in a manner equivalent to the {{URL/search}} setter. -

URLSearchParams class

@@ -3813,10 +3794,6 @@ object query:
  • Set query's URL object's URL's query to serializedQuery. - -

  • If serializedQuery is null, then - potentially strip trailing spaces from an opaque path with query's - URL object.