Extracting attachments #2116

Different MIME configuration needs a fallback logic. Instead of looking
for the attachment "fname" in `("attachment" . (filename "fname"))` structure,
we find the same file name in `("mime-type" . (name . "fname"))` structure
by searching, since we don't know the MIME type beforehand.

Thanks @thierryvolpiatto.
This commit is contained in:
Daniel Fleischer 2021-08-30 14:42:59 +03:00
parent 4404a57365
commit 151a2a323f
1 changed files with 4 additions and 1 deletions

View File

@ -491,7 +491,10 @@ containing commas."
#'completing-read-multiple))
dir)
(dolist (part parts)
(let ((fname (cdr (assoc 'filename (assoc "attachment" (cdr part))))))
(let ((fname (or (cdr (assoc 'filename (assoc "attachment" (cdr part))))
(cl-loop for item in part
for name = (and (listp item) (assoc-default 'name item))
thereis (and (stringp name) name)))))
(when fname
(push `(,fname . ,(cdr part)) handles)
(push fname files))))