fix: prevent silent attachment loss on email forwarding#166
Open
neilhtennek wants to merge 1 commit intoinboundemail:mainfrom
Open
fix: prevent silent attachment loss on email forwarding#166neilhtennek wants to merge 1 commit intoinboundemail:mainfrom
neilhtennek wants to merge 1 commit intoinboundemail:mainfrom
Conversation
When getAttachmentContent() returns null, the forwarder was silently skipping the attachment and continuing with the send. The email would be marked as successfully delivered with the original attachment count logged, but the actual forwarded email could be missing attachments. This changes the behavior to throw an error when an attachment can't be retrieved, so the forwarding fails visibly and can be retried or flagged instead of silently losing data.
Contributor
|
@neilhtennek is attempting to deploy a commit to the inbound Team on Vercel. A member of the Team first needs to authorize it. |
Author
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
getAttachmentContent()fails to retrieve an attachment (missing raw email data, malformed MIME, parser error), the forwarder logs a warning and callscontinue— silently skipping the attachment. The email still forwards and gets marked as delivered. The success log even reports the original attachment count, not the actual number included.This means a user can receive a forwarded email that is missing attachments with no indication that anything went wrong. Silent data loss.
Fix
Replace the
continuewith athrowso the forwarding operation fails visibly when an attachment cannot be retrieved. The existing error handling in the caller (email-router.ts) already catches this, marks the email as failed, and logs the error — so the failure surfaces properly instead of being swallowed.Before
After
One line change. No new dependencies.
@neilhtennek | @PreviewOps