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.
This commit is contained in:
rustmailer
2026-05-29 16:43:38 +08:00
parent d40ba90b54
commit 1346dd216a
+11 -3
View File
@@ -50,9 +50,17 @@ pub async fn extract_envelope_and_store_it(
.map(|d| d.timestamp_millis()) .map(|d| d.timestamp_millis())
.unwrap_or(0); .unwrap_or(0);
let uid = fetch.uid.unwrap_or(0); let uid = fetch.uid.unwrap_or(0);
let body = fetch let body = match fetch.body() {
.body() Some(b) => b,
.ok_or_else(|| raise_error!("No body available".into(), ErrorCode::InternalError))?; 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); let size = fetch.size.unwrap_or(body.len() as u32);
extract_envelope_core(body, uid, size, internal_date, account_id, mailbox_id).await extract_envelope_core(body, uid, size, internal_date, account_id, mailbox_id).await
} }