melib: ignore Draft body if empty for multipart mail

memfd
Manos Pitsidianakis 2020-04-04 19:17:16 +03:00
parent ad2a51891b
commit 5842a63e37
Signed by: Manos Pitsidianakis
GPG Key ID: 73627C2F690DF710
1 changed files with 5 additions and 3 deletions

View File

@ -300,9 +300,11 @@ impl Draft {
} else {
let mut parts = Vec::with_capacity(self.attachments.len() + 1);
let attachments = std::mem::replace(&mut self.attachments, Vec::new());
let mut body_attachment = AttachmentBuilder::default();
body_attachment.set_raw(self.body.as_bytes().to_vec());
parts.push(body_attachment);
if !self.body.is_empty() {
let mut body_attachment = AttachmentBuilder::default();
body_attachment.set_raw(self.body.as_bytes().to_vec());
parts.push(body_attachment);
}
parts.extend(attachments.into_iter());
build_multipart(&mut ret, MultipartType::Mixed, parts);
}