From e2ce627197576581ae7c996169091158eec52746 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=86var=20Arnfj=C3=B6r=C3=B0=20Bjarmason?= Date: Mon, 1 Aug 2016 21:11:05 +0200 Subject: [PATCH] Actually make the "write attachments" feature in d16957d work This is a follow-up to my pull request #895 which fixes another bug in pull request #831 (d16957d). The code to write out the attachments would never work, for what it's worth it's clear from the issue I fixed in #895 that the codepath had never been executed as-is. It would find the attachments and try to write them out to /tmp/, just that, no /tmp/NAME, just the directory itself. That would yield an error of trying to write to a directory. Fix that, now we create a temporary name as a function of the attachment and both save it and extract it. This makes the mu4e-action-view-in-browser function finally work for me. It'll now write out the attachments to /tmp, and rewrite the HTML so that I'll see the attachments in my browser. --- mu4e/mu4e-actions.el | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/mu4e/mu4e-actions.el b/mu4e/mu4e-actions.el index 0128c528..9159723e 100644 --- a/mu4e/mu4e-actions.el +++ b/mu4e/mu4e-actions.el @@ -93,8 +93,9 @@ return the filename." (if (plist-get attachment :temp) (replace-match (format "src=\"%s\"" (plist-get attachment :temp))) (replace-match (format "src=\"%s%s\"" temporary-file-directory (plist-get attachment :name))) - (mu4e~proc-extract 'save (mu4e-message-field msg :docid) (plist-get attachment :index) mu4e-decryption-policy temporary-file-directory) - (mu4e-remove-file-later (format "%s%s" temporary-file-directory (plist-get attachment :name)))))) + (let ((tmp-attachment-name (format "%s%s" temporary-file-directory (plist-get attachment :name)))) + (mu4e~proc-extract 'save (mu4e-message-field msg :docid) (plist-get attachment :index) mu4e-decryption-policy tmp-attachment-name) + (mu4e-remove-file-later tmp-attachment-name))))) attachments) (save-buffer) tmpfile)))