server: handle application/* as an attachment
This commit is contained in:
@@ -479,6 +479,12 @@ pub fn attachment_bytes(nm: &Notmuch, id: &str, idx: &[usize]) -> Result<Attachm
|
||||
let file = File::open(&path)?;
|
||||
let mmap = unsafe { MmapOptions::new().map(&file)? };
|
||||
let m = parse_mail(&mmap)?;
|
||||
if idx.is_empty() {
|
||||
let Some(attachment) = extract_attachment(&m, id, &[]) else {
|
||||
return Err(ServerError::PartNotFound);
|
||||
};
|
||||
return Ok(attachment);
|
||||
}
|
||||
if let Some(attachment) = walk_attachments(&m, |sp, cur_idx| {
|
||||
if cur_idx == idx {
|
||||
let attachment = extract_attachment(&sp, id, idx).unwrap_or(Attachment {
|
||||
|
||||
Reference in New Issue
Block a user