Re: [whatwg/url] Allow queries in relative references when the baseURL has an opaque path (Issue #668)

Since paths are opaque in those URLs, I think it is logical that we cannot resolve a relative path against them (they don't have a hierarchical structure that the standard recognises; we can't assume what they mean or how to combine the given relative path with the existing contents). A relative URL string without any leading delimiter is assumed to be a relative path.

I think the more appropriate consistency domain here is between query and fragment. They both require a leading delimiter, so we know unambiguously which component they refer to, and that they are absolute values rather than relative (both query and fragment are fully opaque; there is no concept of a "relative query" or "relative fragment").

As well as being consistent between query and fragment, it would improve consistency between URLs with opaque paths and those with hierarchical paths:

| Kind        | base URL    | "?b" relative to base | "#b" relative to base |
|-------------|-------------|-----------------------|-----------------------|
| Special     | `http://a/` | `http://a/?b`         | `http://a/#b`         |
| Path-only   | `test:/a`   | `test:/a?b`           | `test:/a#b`           |
| Opaque path | `test:a`    | ERROR                 | `test:a#b`            |

The error here appears to have an obvious solution.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/url/issues/668#issuecomment-1456488883
You are receiving this because you are subscribed to this thread.

Message ID: <whatwg/url/issues/668/1456488883@github.com>

Received on Monday, 6 March 2023 16:41:45 UTC