Fix: Strict RFC822.SIZE == BODY[] length check discards good mail

This commit is contained in:
Maurus Decimus
2026-06-27 12:00:12 +02:00
parent 3e9d4593f7
commit 6ca561fff5
9 changed files with 31 additions and 20 deletions
+5 -3
View File
@@ -707,7 +707,7 @@ fn coordinator_falls_back_to_uid_fetch_when_search_all_bad() {
}
#[test]
fn coordinator_skips_message_on_size_mismatch() {
fn coordinator_imports_message_despite_size_mismatch() {
let control = control_script_one_folder(100, 2, &[1]);
let worker: Script = Box::new(|conn: &mut MockConn| -> std::io::Result<()> {
auth_preamble(conn, "IMAP4rev2 LITERAL+ AUTH=PLAIN")?;
@@ -734,8 +734,10 @@ fn coordinator_skips_message_on_size_mismatch() {
.iter()
.find(|(k, _)| *k == "email")
.unwrap();
assert_eq!(email.1.skipped, 1);
assert_eq!(email.1.created, 0);
assert_eq!(email.1.skipped, 0);
assert_eq!(email.1.created, 1);
let dbc = Connection::open(&archive).unwrap();
assert_eq!(count(&dbc, "emails"), 1);
}
fn single_inbox_scripts(uidvalidity: u32, uidnext: u32, body: &'static [u8]) -> Vec<Script> {
+8 -2
View File
@@ -863,7 +863,10 @@ fn import_missing_email_blob_is_skipped_and_counted_once() {
.find(|(t, _)| *t == "Email")
.map(|(_, c)| c.clone())
.expect("email counts");
assert_eq!(email.fetched, 1, "only the email with a present blob imports");
assert_eq!(
email.fetched, 1,
"only the email with a present blob imports"
);
assert_eq!(
email.failed, 1,
"a missing blob counts the email failed exactly once, not twice"
@@ -2571,7 +2574,10 @@ fn export_duplicate_role_mailbox_created_as_plain_folder_keeping_subtree() {
.find(|(t, _)| *t == "Mailbox")
.map(|(_, c)| c.clone())
.expect("mailbox counts");
assert_eq!(counts.skipped, 2, "Inbox and Sent match existing role mailboxes");
assert_eq!(
counts.skipped, 2,
"Inbox and Sent match existing role mailboxes"
);
assert_eq!(
counts.created, 2,
"duplicate-role folder and its child are both created"