]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-imap: imap-bodystructure: Fixed handling of a multipart part without children...
authorStephan Bosch <stephan.bosch@dovecot.fi>
Wed, 12 Apr 2017 08:13:15 +0000 (10:13 +0200)
committerTimo Sirainen <timo.sirainen@dovecot.fi>
Wed, 12 Apr 2017 08:56:41 +0000 (11:56 +0300)
In that case it writes an empty text/plain part to prevent generating an invalid BODYSTRUCURE.
However, it always generated the basic BODY version without the extra fields for a full BODYSTRUCTURE.

src/lib-imap/imap-bodystructure.c

index 73c3ff512f0e7354fb593699a53cab11eba380c7..2e58f40741ac3a297069b3be5fc78a779c8a6d38 100644 (file)
 #include "imap-envelope.h"
 #include "imap-bodystructure.h"
 
-#define EMPTY_BODYSTRUCTURE "(\"text\" \"plain\" " \
+#define EMPTY_BODY "(\"text\" \"plain\" " \
        "(\"charset\" \""MESSAGE_PART_DEFAULT_CHARSET"\") NIL NIL \"7bit\" 0 0)"
+#define EMPTY_BODYSTRUCTURE "(\"text\" \"plain\" " \
+       "(\"charset\" \""MESSAGE_PART_DEFAULT_CHARSET"\") NIL NIL \"7bit\" 0 0 " \
+               "NIL NIL NIL NIL)"
 
 /*
  * IMAP BODY/BODYSTRUCTURE write
@@ -118,7 +121,10 @@ static void part_write_body_multipart(const struct message_part *part,
                /* no parts in multipart message,
                   that's not allowed. write a single
                   0-length text/plain structure */
-               str_append(str, EMPTY_BODYSTRUCTURE);
+               if (!extended)
+                       str_append(str, EMPTY_BODY);
+               else
+                       str_append(str, EMPTY_BODYSTRUCTURE);
        }
 
        str_append_c(str, ' ');