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

Bug fix: Unable to display images when the path contains Chinese characters #111

Merged
merged 1 commit into from
Dec 31, 2023

Conversation

yeyt97
Copy link
Contributor

@yeyt97 yeyt97 commented Dec 24, 2023

Using URL encoding will cause Chinese characters to display as garbled text, making it impossible to correctly display images with Chinese file paths. By using the urllib.parse.unquote() method to restore the garbled URL, the Chinese characters can be displayed properly.

Copy link

codecov bot commented Dec 31, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (5d77515) 97.75% compared to head (45609d2) 97.75%.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #111   +/-   ##
=======================================
  Coverage   97.75%   97.75%           
=======================================
  Files          10       10           
  Lines         623      624    +1     
  Branches       89       89           
=======================================
+ Hits          609      610    +1     
  Misses          9        9           
  Partials        5        5           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@DatGuy1
Copy link
Owner

DatGuy1 commented Dec 31, 2023

I don't know if this is the best way to go about this since what we're really doing here is using os.fsencode(), urllib.parse.quote_from_bytes(), and them immediately unquoting, but it passes the tests and seems to work fine. Merging.

@DatGuy1 DatGuy1 merged commit aec605e into DatGuy1:main Dec 31, 2023
9 checks passed
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