]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-storage: Attachment detection shouldn't cause mime.parts parsing when copying...
authorTimo Sirainen <timo.sirainen@open-xchange.com>
Thu, 24 Oct 2019 16:17:23 +0000 (19:17 +0300)
committeraki.tuomi <aki.tuomi@open-xchange.com>
Mon, 28 Oct 2019 09:30:06 +0000 (09:30 +0000)
src/lib-storage/mail-storage.c

index 802c7fd43c4197d3c4da91d83f45c8345508a812..b4528fe033c52320795254ff4c8aa38a2b473a06 100644 (file)
@@ -2454,8 +2454,6 @@ struct mail_save_context *
 mailbox_save_alloc(struct mailbox_transaction_context *t)
 {
        struct mail_save_context *ctx;
-       const struct mail_storage_settings *mail_set =
-               mailbox_get_settings(t->box);
        T_BEGIN {
                ctx = t->box->v.save_alloc(t);
        } T_END;
@@ -2473,11 +2471,6 @@ mailbox_save_alloc(struct mailbox_transaction_context *t)
                mailbox_save_dest_mail_close(ctx);
        }
 
-       /* make sure parts get parsed early on */
-       if (mail_set->parsed_mail_attachment_detection_add_flags_on_save)
-               mail_add_temp_wanted_fields(ctx->dest_mail,
-                                           MAIL_FETCH_MESSAGE_PARTS, NULL);
-
        return ctx;
 }
 
@@ -2600,6 +2593,13 @@ int mailbox_save_begin(struct mail_save_context **ctx, struct istream *input)
        i_assert(((*ctx)->transaction->flags & MAILBOX_TRANSACTION_FLAG_FILL_IN_STUB) == 0 ||
                 (*ctx)->data.stub_seq != 0);
 
+       /* make sure parts get parsed early on */
+       const struct mail_storage_settings *mail_set =
+               mailbox_get_settings(box);
+       if (mail_set->parsed_mail_attachment_detection_add_flags_on_save)
+               mail_add_temp_wanted_fields((*ctx)->dest_mail,
+                                           MAIL_FETCH_MESSAGE_PARTS, NULL);
+
        if (!(*ctx)->copying_or_moving) {
                /* We're actually saving the mail. We're not being called by
                   mail_storage_copy() because backend didn't support fast