From: Timo Sirainen Date: Tue, 4 May 2021 11:12:20 +0000 (+0300) Subject: imap: copy/move: Refresh source mailbox before copying/moving X-Git-Tag: 2.3.16~218 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=2227e1ab772c8612fb231bff81485c00bc650f72;p=thirdparty%2Fdovecot%2Fcore.git imap: copy/move: Refresh source mailbox before copying/moving This way if another session had just expunged mails, the expunges will be noticed and the copy/move will abort early. --- diff --git a/src/imap/cmd-copy.c b/src/imap/cmd-copy.c index 660f640051..85981bef3f 100644 --- a/src/imap/cmd-copy.c +++ b/src/imap/cmd-copy.c @@ -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);