mu4e-mime-parts: don't try to open non-files
When completion fails, don't try to open any files in mu4e-view-save-attachments.
This commit is contained in:
@ -297,13 +297,13 @@ does not have this limitation."
|
|||||||
(interactive "P")
|
(interactive "P")
|
||||||
(let* ((parts (mu4e-view-mime-parts))
|
(let* ((parts (mu4e-view-mime-parts))
|
||||||
(candidates (seq-map
|
(candidates (seq-map
|
||||||
(lambda (fpart)
|
(lambda (fpart)
|
||||||
(cons ;; (filename . annotation)
|
(cons ;; (filename . annotation)
|
||||||
(plist-get fpart :filename)
|
(plist-get fpart :filename)
|
||||||
fpart))
|
fpart))
|
||||||
(seq-filter
|
(seq-filter
|
||||||
(lambda (part) (plist-get part :attachment-like))
|
(lambda (part) (plist-get part :attachment-like))
|
||||||
parts)))
|
parts)))
|
||||||
(candidates (or candidates
|
(candidates (or candidates
|
||||||
(mu4e-warn "No attachments for this message")))
|
(mu4e-warn "No attachments for this message")))
|
||||||
(files (mu4e--completing-read "Save file(s): " candidates
|
(files (mu4e--completing-read "Save file(s): " candidates
|
||||||
@ -316,8 +316,10 @@ does not have this limitation."
|
|||||||
(path (mu4e--uniqify-file-name
|
(path (mu4e--uniqify-file-name
|
||||||
(mu4e-join-paths
|
(mu4e-join-paths
|
||||||
(or custom-dir (plist-get part :target-dir))
|
(or custom-dir (plist-get part :target-dir))
|
||||||
(plist-get part :filename)))))
|
(plist-get part :filename))))
|
||||||
(mm-save-part-to-file (plist-get part :handle) path)))
|
(handle (plist-get part :handle)))
|
||||||
|
(when handle ;; completion may fail, and then there's no handle.
|
||||||
|
(mm-save-part-to-file handle path))))
|
||||||
files)))
|
files)))
|
||||||
|
|
||||||
(defvar mu4e-view-mime-part-actions
|
(defvar mu4e-view-mime-part-actions
|
||||||
|
|||||||
Reference in New Issue
Block a user