Repository navigation
Conversation
Downloading a file whose name contains non-ASCII characters threw `TypeError: Header 'Content-Disposition' has invalid value` from `new Response()`, so the download failed entirely. A name containing a double quote produced a malformed header instead. Add a shared `getAttachmentContentDisposition()` helper (RFC 6266 / RFC 5987): plain ASCII names keep the exact historical header, while unsafe names get a sanitized ASCII fallback plus a `filename*` parameter carrying the exact UTF-8 name. Wire it through both download routes and both file-proxy paths, and add regression tests covering the helper and both download forms. Related: tscircuit#5
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.
Fixes downloads failing for non-ASCII filenames and malformed headers for quoted filenames.
All four download paths interpolated the raw filename into the
Content-Dispositionheader, which throwsTypeError: Header 'Content-Disposition' has invalid valuefromnew Response()for any non-ASCII name (the download fails entirely) and produces a malformed header for names containing".getAttachmentContentDisposition()inlib/utils/content-disposition.ts: plain ASCII names keep the exact historical header; unsafe names get a sanitized ASCII fallback plus an RFC 5987filename*=UTF-8''...parameter carrying the exact UTF-8 name/claim #5