]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-mail: message-snippet - Stop building snippet on first non-empty part
authorAki Tuomi <aki.tuomi@open-xchange.com>
Thu, 28 Jan 2021 15:01:38 +0000 (17:01 +0200)
committerAki Tuomi <aki.tuomi@open-xchange.com>
Thu, 4 Feb 2021 11:23:09 +0000 (13:23 +0200)
When we have gotten some snippet out of first eligible part,
we can stop.

src/lib-mail/message-snippet.c

index 4cd55f16c733350f0ff9c86c1512b33dbab449b9..2982e2eece499ac20e870f445b9cbe53502c8c1b 100644 (file)
@@ -166,6 +166,12 @@ int message_snippet_generate(struct istream *input,
                        if (block.hdr != NULL)
                                continue;
 
+                       /* We already have a snippet, don't look for more in
+                          subsequent parts. */
+                       if (ctx.snippet.snippet->used != 0 ||
+                           ctx.quoted_snippet.snippet->used != 0)
+                               break;
+
                        skip_part = NULL;
 
                        /* end of headers - verify that we can use this