From: Timo Sirainen Date: Mon, 12 Mar 2018 13:06:13 +0000 (+0200) Subject: imapc: Don't try to add mails to index if they already exist there X-Git-Tag: 2.3.1~18 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=a28e0824373059166a526116b5710fb2fffbb5e1;p=thirdparty%2Fdovecot%2Fcore.git imapc: Don't try to add mails to index if they already exist there Broken by 259a4ca5943123915a019799623d2e4a4ef7fd15 when imapc was used with (not in-memory) index files. This caused errors like "Append with UID 200, but next_uid = 201" --- diff --git a/src/lib-storage/index/imapc/imapc-mailbox.c b/src/lib-storage/index/imapc/imapc-mailbox.c index 048b037a22..d4cbc4ec3c 100644 --- a/src/lib-storage/index/imapc/imapc-mailbox.c +++ b/src/lib-storage/index/imapc/imapc-mailbox.c @@ -401,7 +401,8 @@ imapc_mailbox_msgmap_update(struct imapc_mailbox *mbox, } else { /* newly seen message */ imapc_msgmap_append(msgmap, rseq, uid); - if (uid < mbox->min_append_uid) { + if (uid < mbox->min_append_uid || + uid < mail_index_get_header(mbox->delayed_sync_view)->next_uid) { /* message is already added to index */ } else { mail_index_append(mbox->delayed_sync_trans,