-
Notifications
You must be signed in to change notification settings - Fork 54
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
URI encoding in Content State #2292
Comments
I don't think there is any uncertainty about number of encoding/decoding actions. Per https://datatracker.ietf.org/doc/html/rfc3986#section-2.4 encoding SHOULD be done once when the URI is assembled from its component parts, and decoding MUST be done once when the URI is disassembled into its component parts (see also https://datatracker.ietf.org/doc/html/rfc3986#section-7.3). Attempts to do encoding/decoding separately from the URI assembly/disassembly steps will, in the general case, lead to errors. Let's work though an example: If I build a URI from Now say that I then build another URI that references URI1 in its query, with components Thus, to take Rob's example, if I am given a Content State URL:
this means (decode as we split) (In this case we could just as well have used |
To put the above another way: We don't get a choice of specifying when something should or should not be URI encoded, it is already part of the URI spec (albeit with great latitude allowing much more than the bare minimum to be encoded if one chooses). We can add helpful reminders though. |
To work a more normal case (I chose %2550 as an easy one to read): a manifest and viewer that themselves have query params. So, the manifest's URI is: We construct the parameter first: (the Then we add the query param We then add the encoded param: And encode:
with a result of
Assuming that If that's correct, and even if we're just following the rules, I think having that spelled out in no uncertain terms is necessary for folks to end up at the same conclusion. |
@azaroth42 - I agree with the above except the encoding of This is not part of RFC3986 URI syntax requirements -- they generally would allow However, the
To rerun your example:
(for fully minimal encoding, which I don't recommend, the additional
) |
I'm convinced :) I think the above recipe should be published, preferably in the next version of the spec, and before then as a cookbook recipe. |
The current 1.0 spec is non-deterministic about embedded URI decoding in the plain URI case.
The encoding requirement is:
However it doesn't give an algorithm as how to interpret the URIs embedded in the query parameter in terms of URI encoding.
The previous decision for the proposed spec was to encode them (cf discovery#90) and then was changed to URI encode them after TRC feedback, but that URI encoding requirement never seems to have made it into the spec.
Currently I believe it is non-deterministic as to how a client should interpret the payload:
iiif-content=https://example.org/manifest/%2550
-- is it%50
(1 encoding) orP
(2 encodings) or%2550
(0 encodings) on the end?The text was updated successfully, but these errors were encountered: