From 203560396ea67bac7a7375cd2fbfa99433b672a9 Mon Sep 17 00:00:00 2001 From: Craig Jennings Date: Tue, 12 May 2026 00:35:20 -0500 Subject: refactor(mail): fail fast on an attachment part with no MIME handle `cj/mu4e--save-attachment-part' called `cj/mu4e--ensure-attachment-save-functions' first, so a part with no MIME handle triggered the `mu4e-mime-parts' load before the handle check could fail. The handle check now runs first, so the malformed input is caught right away and the user-error fires the same way whether or not mu4e's MIME support is loadable. The test for that case drops the mu4e stubs it only needed because the load used to come first. --- modules/mu4e-attachments.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'modules') diff --git a/modules/mu4e-attachments.el b/modules/mu4e-attachments.el index 87392681..8f711000 100644 --- a/modules/mu4e-attachments.el +++ b/modules/mu4e-attachments.el @@ -87,11 +87,11 @@ The result is an alist of display labels to MIME part plists." (defun cj/mu4e--save-attachment-part (part directory) "Save attachment PART to DIRECTORY and return the final path." - (cj/mu4e--ensure-attachment-save-functions) (let ((handle (plist-get part :handle))) (unless handle (user-error "Attachment has no MIME handle: %s" (or (plist-get part :filename) ""))) + (cj/mu4e--ensure-attachment-save-functions) (let* ((path (funcall mu4e-uniquify-save-file-name-function (mu4e-join-paths directory (plist-get part :filename))))) -- cgit v1.2.3