From a959c603be1b53bab3cfe4c7d357f4d9f02d2927 Mon Sep 17 00:00:00 2001 From: Timo Sirainen Date: Tue, 4 May 2021 14:12:20 +0300 Subject: [PATCH] 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. --- src/imap/cmd-copy.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) 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); -- 2.47.3