fix: Migration to v1.0 panics with index out of bounds: the len is 0 but the index is 0 #234

This commit is contained in:
rustmailer
2026-05-19 12:12:37 +08:00
parent a4f8e674c3
commit ff64b66f79
+6
View File
@@ -259,6 +259,12 @@ impl NewIndexWriter {
.parse(eml_bytes)
.ok_or_else(|| raise_error!("failed to parse eml".into(), ErrorCode::InternalError))?;
if message.parts.is_empty() {
return Err(raise_error!(
"Malformed or completely empty EML (no parts found)".into(),
ErrorCode::InternalError
));
}
// ── text / preview ────────────────────────────────────────────────
let text = message
.body_text(0)