mu4e: Add a mime-type-check when importing a pgp-key from an attachment

This commit is contained in:
Moritz Müller
2020-03-05 14:00:34 +01:00
committed by Dirk-Jan C. Binnema
parent 81e0c49084
commit 090ff42c50

View File

@ -1457,8 +1457,11 @@ If PIPECMD is nil, ask user for it."
"Import MSG's attachment ATTACHNUM into the gpg-keyring."
(interactive)
(let* ((att (mu4e~view-get-attach msg attachnum))
(index (plist-get att :index)))
(mu4e~view-temp-action (mu4e-message-field msg :docid) index 'gpg)))
(index (plist-get att :index))
(mime-type (plist-get att :mime-type)))
(if (string= "application/pgp-keys" mime-type)
(mu4e~view-temp-action (mu4e-message-field msg :docid) index 'gpg)
(mu4e-error "Invalid mime-type for a pgp-key: `%s'" mime-type))))
(defun mu4e-view-attachment-action (&optional msg)
"Ask user what to do with attachments in MSG