fix: support non-ASCII filenames in file download headers (RFC 5987)#348
Open
vincentmaria wants to merge 1 commit into
Open
fix: support non-ASCII filenames in file download headers (RFC 5987)#348vincentmaria wants to merge 1 commit into
vincentmaria wants to merge 1 commit into
Conversation
|
All contributors have signed the CLA ✍️ ✅ |
|
Thanks for mentioning! :) That commit is actually included in PR #181 which is currently under review. I was too lazy to submit a new separated PR back at that time. Sorry for the confusion. 😂 |
Author
|
I have read the CLA Document and I hereby sign the CLA |
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.
Problem
When downloading attachments or EML files with non-ASCII characters in their filename (e.g. German umlauts like
ä,ö,ü), the backend throws a Node.jsERR_INVALID_CHARerror and returns HTTP 500:This affects all file downloads via
GET /api/v1/storage/downloadwhere the filename contains characters outside the ASCII range.Closes #182
Root Cause
storage.controller.tssets the header as:Node.js rejects non-ASCII bytes in HTTP headers.
Fix
Encode the filename using RFC 5987 (
filename*=UTF-8''...), which is supported by all modern browsers (Firefox 5+, Chrome 13+, Safari 6+):Changes
packages/backend/src/api/controllers/storage.controller.ts:2-line change
Prior Work
A nearly identical fix was independently implemented by @prinsss in their fork (commit prinsss/OpenArchiver@021f34f, October 2025) but was never submitted as a PR to this repository.