From: Timo Sirainen Date: Wed, 18 May 2016 18:46:46 +0000 (+0300) Subject: lib-imap-storage: Fixed fetching partial headers for message/rfc822 part X-Git-Tag: 2.3.0.rc1~3695 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=21d094cf5f58da522150ec2ebc009fba96b700f4;p=thirdparty%2Fdovecot%2Fcore.git lib-imap-storage: Fixed fetching partial headers for message/rfc822 part Again broken by 333602c40. --- diff --git a/src/lib-imap-storage/imap-msgpart.c b/src/lib-imap-storage/imap-msgpart.c index aa1698231c..0e8428ccb8 100644 --- a/src/lib-imap-storage/imap-msgpart.c +++ b/src/lib-imap-storage/imap-msgpart.c @@ -375,12 +375,7 @@ imap_msgpart_get_partial_header(struct mail *mail, struct istream *mail_input, struct istream *input; bool has_nuls; - if (msgpart->fetch_type == FETCH_HEADER_FIELDS) { - /* mail_get_header_stream() already filtered out the - unwanted headers. */ - input = mail_input; - i_stream_ref(input); - } else { + if (msgpart->fetch_type != FETCH_HEADER_FIELDS) { i_assert(msgpart->fetch_type == FETCH_HEADER_FIELDS_NOT); input = i_stream_create_header_filter(mail_input, HEADER_FILTER_EXCLUDE | @@ -388,6 +383,19 @@ imap_msgpart_get_partial_header(struct mail *mail, struct istream *mail_input, hdr_fields, hdr_count, *null_header_filter_callback, (void *)NULL); + } else if (msgpart->section_number[0] != '\0') { + /* fetching partial headers for a message/rfc822 part. */ + input = i_stream_create_header_filter(mail_input, + HEADER_FILTER_INCLUDE | + HEADER_FILTER_HIDE_BODY, + hdr_fields, hdr_count, + *null_header_filter_callback, + (void *)NULL); + } else { + /* mail_get_header_stream() already filtered out the + unwanted headers. */ + input = mail_input; + i_stream_ref(input); } if (message_get_header_size(input, &hdr_size, &has_nuls) < 0) {