From b8dc77b4576f547d67ffafca5a2d9b3a7b7f8798 Mon Sep 17 00:00:00 2001 From: Stephan Bosch Date: Wed, 12 Apr 2017 10:13:15 +0200 Subject: [PATCH] lib-imap: imap-bodystructure: Fixed handling of a multipart part without children in imap_bodystructure_write(). 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 | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/lib-imap/imap-bodystructure.c b/src/lib-imap/imap-bodystructure.c index 73c3ff512f..2e58f40741 100644 --- a/src/lib-imap/imap-bodystructure.c +++ b/src/lib-imap/imap-bodystructure.c @@ -13,8 +13,11 @@ #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, ' '); -- 2.47.3