From c08fe16a3e5c84195d449ee65e2bf33104cc870e Mon Sep 17 00:00:00 2001 From: Daiki Ueno Date: Thu, 24 May 2012 10:45:38 +0900 Subject: [PATCH] mm-decode: don't touch MIME type for multipart/encrypted children The commit 1bf64efe introduced auto detection of actual MIME types for application/octet-stream. That changes the MIME type of encrypted part to "text/plain" when it has filename parameter with ".asc", and causes decryption failure. --- lisp/mm-decode.el | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lisp/mm-decode.el b/lisp/mm-decode.el index 8076b2e..0ac3254 100644 --- a/lisp/mm-decode.el +++ b/lisp/mm-decode.el @@ -458,6 +458,7 @@ If not set, `default-directory' will be used." (defvar mm-last-shell-command "") (defvar mm-content-id-alist nil) (defvar mm-postponed-undisplay-list nil) +(defvar mm-inhibit-auto-detect-attachement nil) ;; According to RFC2046, in particular, in a digest, the default ;; Content-Type value for a body part is changed from "text/plain" to @@ -668,7 +669,8 @@ MIME-Version header before proceeding." ;; Guess what the type of application/octet-stream parts should ;; really be. (let ((filename (cdr (assq 'filename (cdr cdl))))) - (when (and (equal (car ctl) "application/octet-stream") + (when (and (not mm-inhibit-auto-detect-attachement) + (equal (car ctl) "application/octet-stream") filename (string-match "\\.\\([^.]+\\)$" filename)) (let ((new-type (mailcap-extension-to-mime (match-string 1 filename)))) @@ -694,7 +696,9 @@ MIME-Version header before proceeding." (goto-char (point-max)) (if (re-search-backward close-delimiter nil t) (match-beginning 0) - (point-max))))) + (point-max)))) + (mm-inhibit-auto-detect-attachement + (equal (car ctl) "multipart/encrypted"))) (setq boundary (concat (regexp-quote boundary) "[ \t]*$")) (while (and (< (point) end) (re-search-forward boundary end t)) (goto-char (match-beginning 0)) -- 1.7.10.1