syoyo / tinygltf

Header only C++11 tiny glTF 2.0 library
MIT License
2k stars 408 forks source link

[enhancement] Strict/Proper URI decoding/encoding #369

Closed syoyo closed 1 year ago

syoyo commented 2 years ago

Describe the issue

glTF uses URI for its asset path.

https://github.com/KhronosGroup/glTF/issues/1744 https://registry.khronos.org/glTF/specs/2.0/glTF-2.0.html#uris

Currently TinyGLTF implements simple URI decoding only: https://github.com/syoyo/tinygltf/blob/9117abb45d948b025b533143f678af65c258e1eb/tiny_gltf.h#L2203

Proper and strict URI decoding/encoding are recommended. urlparser https://uriparser.github.io/ Could be a good candidate to handle URI path.

Also, it would need to provide a way to handle absolute URI(e.g. URI containing http prefix) through FS callback.

To Reproduce

Expected behaviour

TinyGLTF decodes/encodes URIs correctly.

We may need glTF files containing various URIs to test.

syoyo commented 1 year ago

Providing strict URI parser may be difficult. For a while, let App/User write their own URI encoder/decoder. tinygltf now has URI callbacks thanks to: https://github.com/syoyo/tinygltf/pull/397