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

Fix Invalid File Path Characters in Cached Image Hashing #562

Merged
merged 2 commits into from
Sep 9, 2023

Conversation

robrab2000
Copy link
Contributor

This pull request addresses an issue with the caching of images where the Base64-encoded hash could produce file paths with invalid characters. The issue was discovered while using an Apple Silicon based MacBook Pro running macOS Ventura (13.5.1) and Unity3d 2021.3.22f1.

Changes made:

  • Modified the GetHash method to convert the MD5 hash from Base64 encoding to a hexadecimal string. This ensures the generated hash string does not contain invalid characters for file paths.
  • Explicitly specified the default encoding in the GetHash method.

These changes resolve caching issues on disk and ensure compatibility across different operating systems.

…alid file path characters

- Replaced the Base64 encoding method in GetHash with a hexadecimal conversion to ensure the generated hash string does not contain invalid characters for file paths on macOS and Windows.
- This resolves issues with caching images on disk where the Base64-encoded hash could produce file paths with invalid characters.
@JoC0de
Copy link
Collaborator

JoC0de commented Sep 7, 2023

Hi @robrab2000
Thanks for the PR. I just changed the Hex to base 64 two weeks ago. I didn't expect that any of the characters are not allowed on some systems. Do you know what char it was? Ok probably we should have used Base64Url as Base64 has '/'

@robrab2000
Copy link
Contributor Author

Hey, yeah it was the '/' that was giving troubles :)

@JoC0de JoC0de merged commit e77fc34 into GlitchEnzo:master Sep 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants