Fix attachment formatting

This commit is contained in:
Thomas Gideon 2023-07-15 21:56:45 -04:00
parent 17e99518ce
commit 4dae4360cc

View file

@ -57,19 +57,22 @@ fn format_attachments(depth: usize, attachments: &[Attachment]) -> String {
if attachments.is_empty() { if attachments.is_empty() {
String::default() String::default()
} else { } else {
attachments format!(
.iter() "\n{}",
.map(|a| { attachments
Url::parse(&a.url).unwrap().open(); .iter()
let mut editor = DefaultEditor::new().unwrap(); .map(|a| {
let src = if let Ok(line) = editor.readline("Filename: ") { Url::parse(&a.url).unwrap().open();
line let mut editor = DefaultEditor::new().unwrap();
} else { let src = if let Ok(line) = editor.readline("Filename: ") {
a.url.clone() line
}; } else {
format!("{} <img src=\"{}\" />", prefix, src) a.url.clone()
}) };
.collect::<Vec<String>>() format!("{} <img src=\"{}\" />", prefix, src)
.join("\n") })
.collect::<Vec<String>>()
.join("\n")
)
} }
} }