mirror of
https://github.com/rustmailer/bichon.git
synced 2026-08-03 07:48:34 +02:00
fix: self-heal missing content blob in download-message
The download-message REST endpoint returned 404 [30000] "Original email content not found" whenever an indexed message's raw content blob was missing from the blob store, leaving the message permanently unrecoverable even though it still existed on the IMAP server. Make the endpoint self-healing: when the content blob is absent, fetch that one message on demand from the IMAP server via UID FETCH <uid> (BODY.PEEK[]), repopulate the detached blob, and return the content. The 404 is now only produced when the on-demand fetch itself fails (mailbox gone, UID gone, connection failure, or the fetched bytes no longer match the archived content_hash). - Add ImapExecutor::fetch_single_message_body: examines the mailbox read-only and fetches one message by UID, reusing the existing BODY.PEEK[] fetch command. - Add reattach_eml_content_self_healing / recover_message_blob in the envelope extractor: fast-path delegates to reattach_eml_content when the blob exists; otherwise recovers it via IMAP and re-stores the stripped EML + attachments through the existing blob queue. - Make store::blob::get_reader async and route it through the self-healing path; update the single caller (download_message). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.7
parent
6eca351994
commit
171a40d70f
@@ -225,7 +225,7 @@ impl MessageApi {
|
||||
AccountModel::check_account_exists(account_id)?;
|
||||
context.require_permission(Some(account_id), Permission::DATA_RAW_DOWNLOAD)?;
|
||||
let envelope_id = envelope_id.0;
|
||||
let reader = get_reader(account_id, envelope_id.clone())?;
|
||||
let reader = get_reader(account_id, envelope_id.clone()).await?;
|
||||
let body = Body::from_async_read(reader);
|
||||
let attachment = Attachment::new(body)
|
||||
.attachment_type(AttachmentType::Attachment)
|
||||
|
||||
Reference in New Issue
Block a user