- From: Karl <notifications@github.com>
- Date: Tue, 05 Sep 2023 09:54:00 -0700
- To: whatwg/url <url@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
- Message-ID: <whatwg/url/issues/784@github.com>
- A URL's opaque path can contain trailing spaces if there is a query or fragment after it - This presents a problem, because if the URL somehow loses its query or fragment, the URL's serialisation will have trailing spaces. Since the parser trims spaces, re-parsing such a URL would not return an equivalent value to one that was serialised. - In #651 we modified the query and fragment setters to safeguard against this - if you use the API to remove the query/fragment, trailing spaces in the opaque path are trimmed. - However, the URL serialiser also has an "exclude fragment" parameter (default false). If this parameter were to be set true, it would produce the same issue as #651 Fixing this will be tricky. I think there are only a couple of options: 1. We just document the status quo; the API/parser/serialiser are idempotent except when "exclude fragment" is set to true, in which case they might corrupt the `path`. That doesn't sound good. It's quite common to exclude the fragment. 2. We trim opaque paths when serialising. That's also not good, because it means the API tells me one thing, but somebody (such as a browser) could serialise the URL without fragment, reparse the result, and the same API property would have a different value. 3. We always trim trailing spaces from opaque paths. Technically a breaking change, but overall it's better at ensuring everything stays consistent. -- Reply to this email directly or view it on GitHub: https://github.com/whatwg/url/issues/784 You are receiving this because you are subscribed to this thread. Message ID: <whatwg/url/issues/784@github.com>
Received on Tuesday, 5 September 2023 16:54:06 UTC