melib: detect plain text in multipart/alternative
parent
8b23ddb920
commit
dad7c09158
|
@ -18,7 +18,7 @@ ui = { path = "ui", version = "*" }
|
||||||
|
|
||||||
[profile.release]
|
[profile.release]
|
||||||
lto = true
|
lto = true
|
||||||
#debug = true
|
debug = true
|
||||||
|
|
||||||
[workspace]
|
[workspace]
|
||||||
members = ["melib", "ui"]
|
members = ["melib", "ui"]
|
||||||
|
|
|
@ -369,6 +369,24 @@ impl Attachment {
|
||||||
ContentType::Text {
|
ContentType::Text {
|
||||||
kind: Text::Html, ..
|
kind: Text::Html, ..
|
||||||
} => true,
|
} => 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 {
|
ContentType::Multipart {
|
||||||
ref subattachments, ..
|
ref subattachments, ..
|
||||||
} => subattachments
|
} => subattachments
|
||||||
|
@ -380,6 +398,10 @@ impl Attachment {
|
||||||
ContentType::Text {
|
ContentType::Text {
|
||||||
kind: Text::Html, ..
|
kind: Text::Html, ..
|
||||||
} => acc,
|
} => acc,
|
||||||
|
ContentType::Multipart {
|
||||||
|
kind: MultipartType::Alternative,
|
||||||
|
..
|
||||||
|
} => a.is_html(),
|
||||||
_ => acc,
|
_ => acc,
|
||||||
}),
|
}),
|
||||||
_ => false,
|
_ => false,
|
||||||
|
|
Loading…
Reference in New Issue