]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
imapc: Don't try to add mails to index if they already exist there
authorTimo Sirainen <timo.sirainen@dovecot.fi>
Mon, 12 Mar 2018 13:06:13 +0000 (15:06 +0200)
committerVille Savolainen <ville.savolainen@dovecot.fi>
Thu, 15 Mar 2018 09:21:52 +0000 (11:21 +0200)
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"

src/lib-storage/index/imapc/imapc-mailbox.c

index 048b037a22ce04cb8a7ff13ad41693a6ddc40c60..d4cbc4ec3c241e10b6851029abffeb1823961b9d 100644 (file)
@@ -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,