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() {
String::default()
} else {
attachments
.iter()
.map(|a| {
Url::parse(&a.url).unwrap().open();
let mut editor = DefaultEditor::new().unwrap();
let src = if let Ok(line) = editor.readline("Filename: ") {
line
} else {
a.url.clone()
};
format!("{} <img src=\"{}\" />", prefix, src)
})
.collect::<Vec<String>>()
.join("\n")
format!(
"\n{}",
attachments
.iter()
.map(|a| {
Url::parse(&a.url).unwrap().open();
let mut editor = DefaultEditor::new().unwrap();
let src = if let Ok(line) = editor.readline("Filename: ") {
line
} else {
a.url.clone()
};
format!("{} <img src=\"{}\" />", prefix, src)
})
.collect::<Vec<String>>()
.join("\n")
)
}
}