Repository navigation
fix(hub): mail an attached file under a US-ASCII name - #114
Merged
Merged
Conversation
The validator the hub runs on attachments lets a name through that the MIME assembler then refuses, since the name goes into a signed header with no encoding; a macOS screenshot name, with its narrow no-break space, failed the whole send with a 500. The material keeps the person's name; the mailed copy carries it made plain.
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.
Closes #113
What
A file attached to a message is mailed to the coordinator under a US-ASCII name, so a name with a non-ASCII character, such as a macOS screenshot's, no longer fails the send.
Why
attachMaterialsruns Interchange'svalidateAttachments, which refuses only an empty name, a line break or a double quote. The MIME assembler then requires US-ASCII, since the name goes into a signedContent-Dispositionheader with no encoding, and throws a plainErrorfor anything else. The hub turned that into a 500 on the mail route and a 503 on the materials route, and the page said "The project could not be reached". macOS names screenshots with a narrow no-break space before "AM". Details in #113.Changes
apps/hub/src/artifacts/materials.ts:mailAttachmentNameturns the person's name into the mailed one: space-like characters become a space, accents are dropped by NFKD, anything else outside printable ASCII is removed, and a double quote becomes an apostrophe. An empty result is "attachment".apps/hub/src/artifacts/service.ts: the mailed copy carries that name; the filed material and the note keep the person's.materials.test.tscovers the screenshot name, accents, quotes, a plain name and a name with nothing ASCII in it.