Fix attachment formatting
This commit is contained in:
parent
17e99518ce
commit
4dae4360cc
1 changed files with 17 additions and 14 deletions
|
@ -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")
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue