Skip to content

Fix mod_zip UTF-8 filename handling for non-ASCII downloads#3171

Merged
zurdi15 merged 2 commits intorommapp:masterfrom
tmgast:fix/mod-zip-utf8
Mar 26, 2026
Merged

Fix mod_zip UTF-8 filename handling for non-ASCII downloads#3171
zurdi15 merged 2 commits intorommapp:masterfrom
tmgast:fix/mod-zip-utf8

Conversation

@tmgast
Copy link
Copy Markdown
Member

@tmgast tmgast commented Mar 24, 2026

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 -- Add X-Archive-Charset: UTF-8 header to ZipResponse so mod_zip sets the UTF-8 flag on all ZIP entries. Also URL-encode the Content-Disposition filename to match FileRedirectResponse behavior.

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.
Copilot AI review requested due to automatic review settings March 24, 2026 21:45
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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-8 to ZipResponse headers so mod_zip marks entries as UTF-8.
  • URL-encode the Content-Disposition filename in ZipResponse to align with existing download response patterns.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@zurdi15 zurdi15 merged commit 4f8232e into rommapp:master Mar 26, 2026
3 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.

4 participants