core-wg / href

Other
2 stars 0 forks source link

Empty paths with the two no-authority versions #46

Closed chrysn closed 1 year ago

chrysn commented 2 years ago

There is something odd about a: (which is in the examples): it is both the URI representation of ["a", null] (= ["a"]) and ["a", true], because the NOAUTHORITY-LEADINGSLASH doesn't produce a leading slash on its own. That does in a sense match what we do with the slash of URL-style CRIs, but having two representations that both convert to the same URI is weird because

a. that makes the URI-to-CRI conversion ambiguous, and

b. resolving a foo ([/discard/ 1, ["foo"]]) against that gives different results depending on how the base is expressed.

A mitigation for b would be to turn discard > 1 on a NOAUTHORITY-NOSLASH into a NOAUTHORITY-LEADINGSLASH (that might be necessary anyway to make foo:bar + ../baz which AIU resolves to foo:/baz resolve correctly) -- but maybe there is a better more comprehensive solution.

(I have, briefly, through that our current trailing slash approach for URL-style CRIs makes the need for the distinguished noauthorities go away -- but it doesn't, at least not on its own.)

cabo commented 1 year ago

To me, it would be more orthogonal to have a: be ["a"]. That makes the name "LEADINGSLASH" suboptimal.

cabo commented 1 year ago

So ["a", true] would be malformed.