fix: unpaired-surrogate attachment names no longer break Gmail sync - #121
Open
charan-rathore wants to merge 1 commit into
Open
charan-rathore wants to merge 1 commit into
charan-rathore wants to merge 1 commit into
Conversation
This branch has not been deployed
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.
What changed
Two places in
packages/integrations/src/google.tsrunencodeURIComponenton attachment names. A name with an unpaired surrogate makes it throw "URI malformed":mapMessage): one sender's bad attachment filename breaks the whole inbox listing on every refresh.GoogleClientMIME builder): a bad attachment name makes the send fail.Both now replace unpaired surrogates with U+FFFD before encoding. I used a small local
wellFormedhelper rather thanString.prototype.toWellFormed(), because the repo targets ES2023 wheretoWellFormeddoes not type-check (TS2550). It is the Gmail-path counterpart of #117, which fixes the truncation side inapps/server/src/files.ts; the two do not overlap. Open #97 also editsgoogle.tsandtests/google.test.tsfor different parsing issues, so a rebase may be needed if it lands first. No issue was filed.Verification
tests/google.test.ts: the two new tests fail on unchanged main with "URI malformed" (25 pass, 2 fail); patched 27/27.npx tsc --noEmitandnpx biome checkon both changed files are clean.tests/*.test.ts: 222 pass, 4 fail. All 4 are intests/browser.test.ts, which fails the same way on an unpatched base.Integration limits
No live Gmail account was used; the tests exercise the mapping and MIME builder directly.