From 1346dd216a7392278ad46750e7544db9a38623af Mon Sep 17 00:00:00 2001 From: rustmailer Date: Fri, 29 May 2026 16:43:38 +0800 Subject: [PATCH] fix: "No body available" #262 When the request returns an empty body, choose to skip it and print the account ID and UID information, leaving it for the user to investigate themselves. Otherwise, the IMAP download process will be blocked by this. --- crates/core/src/envelope/extractor.rs | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/crates/core/src/envelope/extractor.rs b/crates/core/src/envelope/extractor.rs index 978d0d6..a9b30b0 100644 --- a/crates/core/src/envelope/extractor.rs +++ b/crates/core/src/envelope/extractor.rs @@ -50,9 +50,17 @@ pub async fn extract_envelope_and_store_it( .map(|d| d.timestamp_millis()) .unwrap_or(0); let uid = fetch.uid.unwrap_or(0); - let body = fetch - .body() - .ok_or_else(|| raise_error!("No body available".into(), ErrorCode::InternalError))?; + let body = match fetch.body() { + Some(b) => b, + None => { + tracing::warn!( + account_id, + uid = fetch.uid, + "FETCH response has no body, skipping message" + ); + return Ok(()); + } + }; let size = fetch.size.unwrap_or(body.len() as u32); extract_envelope_core(body, uid, size, internal_date, account_id, mailbox_id).await }