mirror of
https://github.com/spartanz51/tutabridge.git
synced 2026-06-24 10:54:32 +02:00
8c1c1dfc540f72e6c9959a7465ee59a677cd508b
The original implementation consumed the cache entry on first lookup, which meant the prefetch sweep that ran first (typically the Sent copy) got its multipart envelope rebuilt correctly, but the second sweep (the Inbox copy, which is the one suffering from the `File._ownerEncSessionKey` race) found an empty cache and fell back to the failing `crypto_client.load` path — leaving its .eml body-only. A self-send produces `load_attachments` calls for both folder copies of the same envelope, so the cache must serve as many lookups as arrive within the TTL. Clone the cached attachments out of the entry instead of removing it; the existing TTL (1h) + soft cap (50 entries) keep memory bounded. Also move the cache insert ahead of `DraftService.post` so the WS event for the inbox copy cannot beat the insert. Live-verified: both Sent and Inbox copies of a self-sent mail with a PDF attachment now expose a proper `multipart/mixed` BODYSTRUCTURE with the file part — no more session-key-transient retry storms in the prefetch logs.
Languages
Rust
89.5%
TypeScript
5.9%
CSS
2.5%
Python
1.2%
Shell
0.7%
Other
0.1%