]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix viewing of encrypted S/MIME messages
authorLars Ingebrigtsen <larsi@gnus.org>
Thu, 23 Jul 2020 15:12:33 +0000 (17:12 +0200)
committerLars Ingebrigtsen <larsi@gnus.org>
Fri, 24 Jul 2020 14:37:28 +0000 (16:37 +0200)
* lisp/gnus/mm-decode.el (mm-possibly-verify-or-decrypt): Don't
add a content-type header if there already is one (bug#41659).

lisp/gnus/mm-decode.el

index d33bb56dc9ee86437c9dfaa4cfb2bc888ecedaa9..a340418507fb7b58bfee82c399215b1e1296db3b 100644 (file)
@@ -1680,8 +1680,14 @@ If RECURSIVE, search recursively."
                    (t (y-or-n-p
                        (format "Decrypt (S/MIME) part? "))))
                   (mm-view-pkcs7 parts from))
-         (goto-char (point-min))
-         (insert "Content-type: text/plain\n\n")
+         ;; Normally there will be a Content-type header here, but
+         ;; some mailers don't add that to the encrypted part, which
+         ;; makes the subsequent re-dissection fail here.
+         (save-restriction
+           (mail-narrow-to-head)
+           (unless (mail-fetch-field "content-type")
+             (goto-char (point-max))
+             (insert "Content-type: text/plain\n\n")))
          (setq parts (mm-dissect-buffer t)))))
      ((equal subtype "signed")
       (unless (and (setq protocol