Closed bramadams closed 3 months ago
Please attach an example message where this happens, thanks.
OK, done!
It works with mu4e-view-mime-part-action
(A
), but not with mu4e-view-save-attachments
since, indeed, the latter depends on names being different.
Guess worth documenting, but perhaps too much a corner-case to try some (I fear ugly) fix. Let me think about it..
Thanks for looking into this.
I wonder if, for the time being, mu4e could display a warning when running mu4e-view-save-attachments
if two or more attachments have the same name? As such, one would be aware of potentially missing something, allowing users to use other means, like mu4e-view-mime-part-action
, to access the attachments.
Perhaps... but one can see the attachments in the view and at least in my experience it's very rare so not really worth adding extra complexity to the code.
So for now I've just documented the behavior. Thanks!
For anyone bitten by this issue, here's an advice automatically re-routing mu4e-view-save-attachments
calls to mu4e-view-mime-part-action
if at least one attachment has a duplicate name. (Since mu4e-view-mime-part-action
does not have a "save all" option, it is more economical to only use it when needed.)
(defun my-handle-attachments-with-duplicate-names (fn &rest args)
(let* ((parts (mu4e-view-mime-parts))
(candidates (seq-map
(lambda (fpart)
(plist-get fpart :filename))
(seq-filter
(lambda (part) (plist-get part :attachment-like))
parts)))
(candidates-set (seq-uniq candidates)))
(if (< (length candidates-set) (length candidates))
;; duplicate names, redirect to mu4e-view-mime-part-action
(mu4e-view-mime-part-action)
(apply fn args))))
(advice-add #'mu4e-view-save-attachments :around #'my-handle-attachments-with-duplicate-names)
Describe the bug
If an email contains multiple attachments with the same name,
mu4e-view-save-attachments
only offers to save one of these attachments, even though the mu4e email view shows all attachment names correctly.How to Reproduce
mu4e-view-save-attachments
example.txt
Environment
Latest mu4e and vertico on emacs 29.3.
I also encounter the issue without vertico, i.e., using standard emacs completion.
Checklist
master
(otherwise please upgrade)