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
Unclear when to percent encode and decode URI strings #2245
Comments
Space and percent have to be percent-encoded.
glTF URIs are normal URIs, all the normal rules apply.
I don't see how it indicates that. The text says reserved characters have to be percent encoded and says non-ASCII characters may be written multiple ways, but neither applies to percent.
If you can reproduce a wrongly encoded URI in the current version, you should report a bug. |
Some strongly related discussion (with a table that shows possible ambiguities that is very similar to the one on the first post here) can be found around #1449 (comment) . |
The trouble is that the published document does not actually say that. I note that the linked issue it's explicitly noted that "space" can be either encoded or unencoded. #1449 (comment) I'm fine with a rule along the lines of "if nothing else needs to be percent-encoded then space may be left as-is", but any paths containing the "%" character absolutely must be encoded.
I agree that the intent probably was that glTF URIs MUST be either URIs (RFC 3986) or IRIs (RFC 3987).
Snippet from a Khronos glTF Blender I/O v3.4.50 export:
|
Section 2.8 URIs is unclear.
It does not appear to be possible for an implementation to determine whether a URI has been percent-encoded or written as-is.
":" / "/" / "?" / "#" / "[" / "]" / "@" / "!" / "$" / "&" / "'" / "(" / ")" / "*" / "+" / "," / ";" / "="
Additionally:
RFC 3986 separately states that "%" MUST be encoded as "%25", but it is unclear from the text whether or not this requirement also applies to glTF - "%" is an ASCII character, and is not an RFC 3986/3987 reserved character, so the text indicates that it MAY be written as-is.
If space and percent MAY be written as-is or percent-encoded, then all of the following are permitted:
It is not possible for a reader to distinguish between cases 2 and 3, or between cases 5 and 6.
A compliant reader must try both URIs (perhaps re-encoding for HTTPS)
I recommend two changes:
a) The wording of the first requirement for relative paths should be changed to:
b) The glTF standard should explicitly require paths containing the "%" character be percent-encoded.
This would prohibit cases 3, 4 and 6, and eliminate the confusion.
Sadly I am aware of implementations that export using all six methods - Blender's Khronos glTF Blender I/O v1.5.17 even does this in the same file!
The text was updated successfully, but these errors were encountered: