Feature: preview .eml (message/rfc822) attachments like an email#380
Merged
Merged
Conversation
Clicking an embedded email attachment (bounce/DSN, forward-as-attachment, ...) opened only a download. Add an 'eml' preview kind: FilePreviewModal parses the blob with postal-mime (dynamic-imported, off the bundle) and renders it via a new EmlPreview component - header (from/to/subject/date) + body + the message's own attachments. The body is sanitized with DOMPurify (sanitizeEmailHtmlForIframe) AND rendered in a fully-locked sandbox iframe (sandbox="" - no scripts, no same-origin), so a script-bearing .eml can never execute in-origin. Reuses the email_viewer locale namespace (no new keys).
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.
Summary
Clicking an
.emlattachment (a bounce/DSN, or an email that was forwarded as an attachment) only offered a download. This previews it inline instead, rendered like an email.Changes
emlpreview kind formessage/rfc822/.emlfiles.FilePreviewModalparses the attachment with postal-mime (dynamic import, so it stays off the main bundle) and renders it via a newEmlPreviewcomponent: header (From / To / Subject / Date), the body, and the message's own attachments.sandbox="") on top of DOMPurify (sanitizeEmailHtmlForIframe), so a script-bearing.emlcan never execute in our origin.Type of Change
Checklist
npm run typecheck && npm run lintpassesnpm run build)locales/) - n/a, reuses the existingemail_viewerlabels (no new keys)Notes for Reviewers
.emland a forwarded-as-attachment message).