fix(email): body fetch retry, CID images, re-render fix#219
fix(email): body fetch retry, CID images, re-render fix#219Systemsaholic merged 1 commit intomainfrom
Conversation
- Add retry logic (up to 2 retries) for IMAP body download failures that previously failed silently, leaving emails permanently unloaded - Resolve CID inline images to base64 data URIs during message parsing so embedded images (common in Outlook) display instead of placeholders - Allow data:image/* URIs through DOMPurify for resolved CID images - Stabilize trustedDomains memo reference to prevent re-render floods from unstable array identity on every profile re-render Addresses critical items in #196 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
📝 WalkthroughWalkthroughThese changes implement retry logic for IMAP body downloads with special handling for authentication failures, enable inline CID image resolution by converting them to base64 data URIs, and update frontend sanitization to permit and handle these data URIs in email HTML. Changes
Sequence DiagramsequenceDiagram
participant Client as Email Reader<br/>(Frontend)
participant IMAPService as IMAP Service
participant Parser as Message Parser
participant Sanitizer as HTML Sanitizer
participant Renderer as Email Renderer
Client->>IMAPService: fetchEmailBody(accountId, emailId)
loop Retry up to MAX_RETRIES+1
alt IMAP Success
IMAPService->>IMAPService: Download IMAP body
break on Authentication Failure
IMAPService->>IMAPService: handleImapAuthFailure()
end
else Transient Failure / Empty
IMAPService->>IMAPService: Log warning & retry
end
end
IMAPService->>Parser: parseMessageSource(buffer)
Parser->>Parser: Extract bodyHtml, attachments
Parser->>Parser: For each cid: image in HTML<br/>Convert attachment to data: URI
Parser-->>IMAPService: Return {bodyHtml, bodyText, snippet}
IMAPService-->>Client: Return resolved email body
Client->>Sanitizer: sanitizeEmailHtml(bodyHtml)
Sanitizer->>Sanitizer: Purify HTML<br/>(allow data:image/ URIs)
Sanitizer-->>Renderer: Return sanitized HTML
Renderer->>Renderer: Render email with<br/>inline images
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related issues
Possibly related PRs
Poem
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary
client.download()now retries up to 2 times on transient failures instead of silently returning null (Sentry: undefined Symbol.asyncIterator errors)cid:references) are resolved to base64 data URIs during message parsing — Outlook/corporate emails now display images instead of gray placeholdersALLOWED_URI_REGEXPupdated to pass throughdata:image/*URIs for resolved CID imagestrustedDomainsarray reference withuseMemoto prevent sanitization re-running on every profile render cycleTest plan
Addresses critical items in #196
🤖 Generated with Claude Code
Summary by CodeRabbit
Bug Fixes
Performance