]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-storage: Don't use cached message_parts while message is being parsed
authorTimo Sirainen <timo.sirainen@open-xchange.com>
Mon, 25 Oct 2021 12:43:00 +0000 (15:43 +0300)
committeraki.tuomi <aki.tuomi@open-xchange.com>
Mon, 21 Feb 2022 16:21:23 +0000 (16:21 +0000)
Finish the parsing instead. Otherwise there can be some confusion about
parsed_bodystructure* fields, which indicate that data->parts have the
bodystructure info while in reality data->parts came from cached fields
and they have no bodystructure info.

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

index 7e0b6f81ac54cf55f02eccebb3ca51427a2db125..48122b1673dbc80b27d46eaa2b947558282eaceb 100644 (file)
@@ -162,6 +162,12 @@ static bool get_cached_parts(struct index_mail *mail)
 
        if (mail->data.parts != NULL)
                return TRUE;
+       if (mail->data.parser_ctx != NULL) {
+               /* Message is already being parsed. Get the message parts by
+                  finishing its parsing, so there won't be any confusion about
+                  whether e.g. data->parsed_bodystructure=TRUE match data->parts  */
+               return FALSE;
+       }
 
        T_BEGIN {
                part = get_unserialized_parts(mail);