fix(storage): RFC 6266 Content-Disposition for non-ASCII attachment filenames#391
Open
gig-repo wants to merge 1 commit into
Open
fix(storage): RFC 6266 Content-Disposition for non-ASCII attachment filenames#391gig-repo wants to merge 1 commit into
gig-repo wants to merge 1 commit into
Conversation
|
All contributors have signed the CLA ✍️ ✅ |
5a043ab to
37d010f
Compare
|
I have read the CLA Document and I hereby sign the CLA |
Downloading an archived attachment whose filename contains non-ASCII characters (e.g. Korean/CJK) returns HTTP 500: res.setHeader throws "TypeError [ERR_INVALID_CHAR]: Invalid character in header content [Content-Disposition]" because a raw filename="..." value must be Latin-1. Emit an ASCII fallback plus an RFC 6266 filename*=UTF-8''<pct-encoded> parameter so the real (Unicode) name is delivered and the header no longer throws. Affects both the REST API and the web UI download. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
37d010f to
f600f37
Compare
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
GET /api/v1/storage/downloadreturns HTTP 500 for any archived file whose name contains non-ASCII characters (Korean / Japanese / Chinese, accented Latin, etc.). The file is located and decrypted fine — the failure is emitting the response header:Node's
res.setHeaderonly accepts Latin-1 in a header value, so:throws whenever
fileNamehas non-Latin-1 bytes. Because the API and the web UI share this endpoint, such attachments can't be downloaded at all.Fix
Follow RFC 6266: send an ASCII-only
filename="..."fallback and afilename*=UTF-8''<percent-encoded>parameter carrying the real name. Modern clients usefilename*; older ones fall back safely.Verification
Reproduced on a running
v0.5.0instance: a Korean-named PDF (장현준_…_원본.pdf) returned 500. After applying the equivalent change to the compiled controller and restarting, the same file now returns 200 with:Scope is limited to one header line in
storage.controller.ts; no behavior change for ASCII filenames.