]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
imap: copy/move: Refresh source mailbox before copying/moving
authorTimo Sirainen <timo.sirainen@open-xchange.com>
Tue, 4 May 2021 11:12:20 +0000 (14:12 +0300)
committertimo.sirainen <timo.sirainen@open-xchange.com>
Wed, 5 May 2021 19:53:55 +0000 (19:53 +0000)
This way if another session had just expunged mails, the expunges will be
noticed and the copy/move will abort early.

src/imap/cmd-copy.c

index 660f640051fbb694b97dc4b42c66c5521c9447cb..85981bef3ff4f4b81bac7d62b775e4154c04934d 100644 (file)
@@ -98,8 +98,10 @@ static int fetch_and_copy(struct cmd_copy_context *copy_ctx,
                                      MAILBOX_TRANSACTION_FLAG_EXTERNAL |
                                      MAILBOX_TRANSACTION_FLAG_ASSIGN_UIDS,
                                      cmd_reason);
-
-       src_trans = mailbox_transaction_begin(copy_ctx->srcbox, 0, cmd_reason);
+       /* Refresh source index so expunged mails will be noticed */
+       src_trans = mailbox_transaction_begin(copy_ctx->srcbox,
+                                             MAILBOX_TRANSACTION_FLAG_REFRESH,
+                                             cmd_reason);
        search_ctx = mailbox_search_init(src_trans, search_args,
                                         NULL, 0, NULL);
        mail_search_args_unref(&search_args);