compose: respect auto_choose_multipart_alternative when rendering multipart/alternative attachments to text
parent
73372ff1e7
commit
bf56c88918
|
@ -688,11 +688,40 @@ impl MailView {
|
||||||
parts.iter().position(|a| a.content_type == "text/plain")
|
parts.iter().position(|a| a.content_type == "text/plain")
|
||||||
{
|
{
|
||||||
let bytes = decode(&parts[text_attachment_pos], None);
|
let bytes = decode(&parts[text_attachment_pos], None);
|
||||||
acc.push(AttachmentDisplay::InlineText {
|
if bytes.trim().is_empty()
|
||||||
inner: a.clone(),
|
&& mailbox_settings!(
|
||||||
comment: None,
|
context[coordinates.0][&coordinates.1]
|
||||||
text: String::from_utf8_lossy(&bytes).to_string(),
|
.pager
|
||||||
});
|
.auto_choose_multipart_alternative
|
||||||
|
)
|
||||||
|
.is_true()
|
||||||
|
{
|
||||||
|
if let Some(text_attachment_pos) =
|
||||||
|
parts.iter().position(|a| a.content_type == "text/html")
|
||||||
|
{
|
||||||
|
/* Select html alternative since text/plain is empty */
|
||||||
|
rec(
|
||||||
|
&parts[text_attachment_pos],
|
||||||
|
context,
|
||||||
|
coordinates,
|
||||||
|
acc,
|
||||||
|
active_jobs,
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
for a in parts {
|
||||||
|
rec(a, context, coordinates, acc, active_jobs);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
/* Select text/plain alternative */
|
||||||
|
rec(
|
||||||
|
&parts[text_attachment_pos],
|
||||||
|
context,
|
||||||
|
coordinates,
|
||||||
|
acc,
|
||||||
|
active_jobs,
|
||||||
|
);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
for a in parts {
|
for a in parts {
|
||||||
rec(a, context, coordinates, acc, active_jobs);
|
rec(a, context, coordinates, acc, active_jobs);
|
||||||
|
|
Loading…
Reference in New Issue