]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-storage: Fix mail_attachment_detection_options=no-flags-on-fetch
authorTimo Sirainen <timo.sirainen@open-xchange.com>
Fri, 12 May 2023 15:48:58 +0000 (18:48 +0300)
committeraki.tuomi <aki.tuomi@open-xchange.com>
Wed, 1 Oct 2025 11:11:18 +0000 (11:11 +0000)
The attachment flag was still added if message body was parsed.

src/lib-storage/index/index-mail.c

index a8a2faebe87189718e147f1d422bdc280fdd0cbc..2f5f8a30eb67aaeec796746c02ff37614af6bc67 100644 (file)
@@ -1239,9 +1239,14 @@ index_mail_parse_body_finish(struct index_mail *mail,
        index_mail_body_parsed_cache_bodystructure(mail, field);
        index_mail_cache_sizes(mail);
        index_mail_cache_dates(mail);
-       if (mail_set->parsed_mail_attachment_detection_add_flags &&
-           !mail_has_attachment_keywords(&mail->mail.mail))
-               index_mail_try_set_attachment_keywords(mail);
+       if (mail->mail.mail.saving) {
+               if (mail_set->parsed_mail_attachment_detection_add_flags &&
+                   !mail_has_attachment_keywords(&mail->mail.mail))
+                       index_mail_try_set_attachment_keywords(mail);
+       } else {
+               if (index_mail_want_attachment_keywords_on_fetch(mail))
+                       index_mail_try_set_attachment_keywords(mail);
+       }
        return 0;
 }