feat(attachments): render inline cid images in place, not as attachments

Inline images (referenced by src="cid:…") are now classified at ingest and
kept out of the downloadable attachment lists, RSS/Atom enclosures, and the
API — while still stored in R2 and cleaned up with the email. Fixes the admin
email preview, which injected raw HTML into the data: iframe so cid refs never
resolved; it now rewrites them to absolute /files URLs.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
Julien Herr
2026-05-24 14:39:59 +02:00
parent be45e70571
commit 5137637181
14 changed files with 277 additions and 31 deletions
+6 -1
View File
@@ -19,6 +19,10 @@ export interface AttachmentData {
contentType: string;
size: number;
contentId?: string; // Normalized Content-ID (no <>) used to resolve inline cid: refs
// True when this attachment is an inline image referenced by a cid: URL in the
// email body. Inline attachments render in place and are hidden from the
// downloadable attachment lists, but are still stored in R2 and cleaned up.
inline?: boolean;
}
// Email interface for stored emails
@@ -59,7 +63,8 @@ export interface EmailMetadata {
subject: string;
receivedAt: number;
size?: number;
attachmentIds?: string[];
attachmentIds?: string[]; // Downloadable attachments (shown to the user)
inlineAttachmentIds?: string[]; // Inline images: hidden from lists, still cleaned up
}
// Feed list interface