server: handle application/* as an attachment

This commit is contained in:
2025-08-18 12:11:31 -07:00
parent 834e873862
commit 574de65c35
3 changed files with 45 additions and 8 deletions

View File

@@ -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 {