Fix mod_zip UTF-8 filename handling for non-ASCII downloads#3171
Merged
zurdi15 merged 2 commits intorommapp:masterfrom Mar 26, 2026
Merged
Fix mod_zip UTF-8 filename handling for non-ASCII downloads#3171zurdi15 merged 2 commits intorommapp:masterfrom
zurdi15 merged 2 commits intorommapp:masterfrom
Conversation
Add X-Archive-Charset: UTF-8 header so mod_zip sets the EFS flag on ZIP entries, ensuring extractors interpret filenames as UTF-8 instead of CP437. Also URL-encode the Content-Disposition filename to match FileRedirectResponse behavior.
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the backend’s Nginx/mod_zip download response helper to ensure ZIP entry filenames are treated as UTF-8 (preventing CP437 fallback and filename mangling for non‑ASCII characters).
Changes:
- Add
X-Archive-Charset: UTF-8toZipResponseheaders so mod_zip marks entries as UTF-8. - URL-encode the
Content-Dispositionfilename inZipResponseto align with existing download response patterns.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
gantoine
approved these changes
Mar 24, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Without
X-Archive-Charset, mod_zip never sets the EFS flag (bit 11) on ZIP entries, so extractors default to CP437 -- mangling em-dashes, CJK characters, and other non-ASCII filenames.Changes
backend/utils/nginx.py-- AddX-Archive-Charset: UTF-8header toZipResponseso mod_zip sets the UTF-8 flag on all ZIP entries. Also URL-encode theContent-Dispositionfilename to matchFileRedirectResponsebehavior.