diff options
author | Manos Pitsidianakis <el13635@mail.ntua.gr> | 2019-05-09 12:28:13 +0300 |
---|---|---|
committer | Manos Pitsidianakis <el13635@mail.ntua.gr> | 2019-06-10 19:40:48 +0300 |
commit | dad7c09158b5a366206c559ebf64647db39aa86f (patch) | |
tree | 0b8c88a2dd51738f6bbd1e28e2025bd4e9e0141f | |
parent | 8b23ddb920abc261402c6af3b271386f04deec11 (diff) |
melib: detect plain text in multipart/alternative
-rw-r--r-- | Cargo.toml | 2 | ||||
-rw-r--r-- | melib/src/mailbox/email/attachments.rs | 22 |
2 files changed, 23 insertions, 1 deletions
@@ -18,7 +18,7 @@ ui = { path = "ui", version = "*" } [profile.release] lto = true -#debug = true +debug = true [workspace] members = ["melib", "ui"] diff --git a/melib/src/mailbox/email/attachments.rs b/melib/src/mailbox/email/attachments.rs index 160f346e..174a3b1c 100644 --- a/melib/src/mailbox/email/attachments.rs +++ b/melib/src/mailbox/email/attachments.rs @@ -369,6 +369,24 @@ impl Attachment { ContentType::Text { kind: Text::Html, .. } => true, + ContentType::Text { + kind: Text::Plain, .. + } => false, + ContentType::Multipart { + kind: MultipartType::Alternative, + ref subattachments, + .. + } => { + for a in subattachments.iter() { + if let ContentType::Text { + kind: Text::Plain, .. + } = a.content_type + { + return false; + } + } + return true; + } ContentType::Multipart { ref subattachments, .. } => subattachments @@ -380,6 +398,10 @@ impl Attachment { ContentType::Text { kind: Text::Html, .. } => acc, + ContentType::Multipart { + kind: MultipartType::Alternative, + .. + } => a.is_html(), _ => acc, }), _ => false, |