fix(attachments): route all viewer blob fetches for cross-account messages

Extend the cross-account blob routing beyond download/preview to every blob
fetch in the message viewer, so a message opened from a different account in the
unified / All-Mail view renders and exports correctly instead of 404ing against
the active account:

- inline cid: images, drag-to-desktop, attachment thumbnails, the "download all"
  zip bundle, and the S/MIME / TNEF / embedded-rfc822 blob reads now use a
  resolved blobClient (getClientForAccount(sourceClientAccountId)) and the owner
  blobAccountId (sourceAccountId), computed once from the open message's source;
- fetchBlobAsObjectUrl / fetchBlobArrayBuffer / fetchBlob calls pass the
  accountId (the client methods gained the param in the previous commit);
- non-cross-account behaviour is unchanged (blobClient === active client).

Extends 10-attachments with an inline-image case (verified to fall back to the
placeholder without the routing). The SMTP helper can now send multipart/related
inline images.
This commit is contained in:
Stefan Hildebrandt
2026-07-11 21:15:49 +02:00
parent 26c3d07d56
commit cdb31634a6
3 changed files with 65 additions and 5 deletions
+6 -4
View File
@@ -112,10 +112,12 @@ because the UI behaviour is currently incomplete. Worth a look:
"Move to" submenu offers the shared folder, but clicking it is a no-op.
Shared ⇆ shared (same owner) moves work. Pinned with `test.fail` in
`08-shared-moves`.
- **Cross-account attachments (fixed).** Blobs are account-scoped, so viewing/
downloading an attachment on an All-Mail message from another account 404'd
against the active account. The download/preview path now routes to the
message's owning client + accountId (`10-attachments`).
- **Cross-account attachments & inline images (fixed).** Blobs are account-
scoped, so viewing/downloading/previewing an attachment, rendering an inline
`cid:` image, dragging out, and the bundle/S-MIME/TNEF/embedded-message
fetches on an All-Mail message from another account 404'd against the active
account. Every viewer blob fetch now routes to the message's owning client +
accountId (`10-attachments` covers download + inline image).
## How the tests work