Skip to content
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

Unable to load files with some special characters #79

Closed
blackbird-91 opened this issue Jun 17, 2020 · 4 comments
Closed

Unable to load files with some special characters #79

blackbird-91 opened this issue Jun 17, 2020 · 4 comments
Assignees
Labels
bug Something isn't working
Milestone

Comments

@blackbird-91
Copy link

When a glb file has a '+' character in it, like "file_a + file_b.glb", the co-routine to load the file fails to read the file. Since windows and mac allows some special characters in filenames, I can't have control on the file names themselves. Is there a way to fix this issue?

IEnumerator LoadRoutine( string url, bool gltfBinary ) {
            
            var download = downloadProvider.Request(url);
            yield return download;

            if(download.success) {
                if(gltfBinary) {
                    LoadGlb(download.data,url);
                } else {
                    LoadGltf(download.text,url);
                }
                yield return LoadContent();
            } else {
                Debug.LogErrorFormat("{0} {1}",download.error,url);
                loadingError=true;
            }

            DisposeVolatileData();
            OnLoadComplete(!loadingError);
        }
@atteneder
Copy link
Owner

Hi,

sorry for the late answer. glTFast uses regular UnityWebRequest under the hood. Everything they can load, glTFast can load. A quick workaround is to escape the + like this:

url = url.Replace("+","%2B");

This worked here also on local paths (starting with file://). There's also the more generic UnityWebRequest.EscapeURL, but make sure you don't escape the full path (as it will escape directory separators as well).

Now this won't help in case any references external file in the glTF (buffer or texture) has a +in its URL. I'd have to fix this inside of glTFast.

hth

@atteneder
Copy link
Owner

Regarding internal URIs, the way I interpret the glTF URI specification I think it's not required to support special characters, but optional. Thus any content-creator creating such URIs has to be aware that his files won't be widely portable.

@atteneder atteneder self-assigned this Nov 15, 2020
@atteneder atteneder added the bug Something isn't working label Nov 15, 2020
@atteneder atteneder added this to the 2.2.0 milestone Nov 15, 2020
@cvetelinast
Copy link

Hi, thank you for your awesome library! You said that UnityWebRequest.Get(url) doesn't support special characters, but then you added a commit about that, should that commit handle this scenario? I can't really make it work.
I have the file A+B.gltf with buffer A+B.bin.
I tried the workarounds that you suggested, for example, I tried to make the field url in GLTFAsset.cs A%2BB.gltf but the file is still not found. If I rename the gltf, it still cannot find the bin.

@atteneder
Copy link
Owner

@cvetelinast Are you loading this from a server (via HTTP) or from local file system? If the latter, which OS and file system do you use?

nickconstantinidis pushed a commit to Unity-Technologies/com.unity.cloud.gltfast that referenced this issue Jan 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants