From: Timo Sirainen Date: Thu, 24 Oct 2019 16:17:23 +0000 (+0300) Subject: lib-storage: Attachment detection shouldn't cause mime.parts parsing when copying... X-Git-Tag: 2.3.9~89 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5eadcfc9f9da73a66119338763867ec5de80bf19;p=thirdparty%2Fdovecot%2Fcore.git lib-storage: Attachment detection shouldn't cause mime.parts parsing when copying mails --- diff --git a/src/lib-storage/mail-storage.c b/src/lib-storage/mail-storage.c index 802c7fd43c..b4528fe033 100644 --- a/src/lib-storage/mail-storage.c +++ b/src/lib-storage/mail-storage.c @@ -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