emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

emacs-30 7799ef43354: Fix Rmail base64 and qp decoding of MIME payloads


From: Eli Zaretskii
Subject: emacs-30 7799ef43354: Fix Rmail base64 and qp decoding of MIME payloads
Date: Mon, 2 Sep 2024 10:16:04 -0400 (EDT)

branch: emacs-30
commit 7799ef43354d756d7144cab3437f38496199522c
Author: Eli Zaretskii <eliz@gnu.org>
Commit: Eli Zaretskii <eliz@gnu.org>

    Fix Rmail base64 and qp decoding of MIME payloads
    
    * lisp/mail/rmailmm.el (rmail-mime-insert-decoded-text)
    (rmail-mime-insert-html): Remove ^M characters left from DOS EOLs.
    This is what 'rmail-decode-region' does for non-MIME messages.
---
 lisp/mail/rmailmm.el | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/lisp/mail/rmailmm.el b/lisp/mail/rmailmm.el
index b4a0e92136e..a5ce5b65cd7 100644
--- a/lisp/mail/rmailmm.el
+++ b/lisp/mail/rmailmm.el
@@ -579,7 +579,11 @@ HEADER is a header component of a MIME-entity object (see
               (ignore-errors (base64-decode-region pos (point))))
              ((string= transfer-encoding "quoted-printable")
               (quoted-printable-decode-region pos (point))))))
-    (decode-coding-region pos (point) coding-system)
+    (decode-coding-region
+     pos (point)
+     ;; Use -dos decoding, to remove ^M characters left from base64 or
+     ;; rogue qp-encoded text.
+     (coding-system-change-eol-conversion coding-system 1))
     (if (and
         (or (not rmail-mime-coding-system) (consp rmail-mime-coding-system))
         (not (eq (coding-system-base coding-system) 'us-ascii)))
@@ -691,7 +695,11 @@ HEADER is a header component of a MIME-entity object (see
            (if (and (eq coding-system 'undecided)
                     (not (null coding-system-for-read)))
                (setq coding-system coding-system-for-read))))
-      (decode-coding-region (point-min) (point) coding-system)
+      (decode-coding-region
+       (point-min) (point)
+       ;; Use -dos decoding, to remove ^M characters left from base64 or
+       ;; rogue qp-encoded text.
+       (coding-system-change-eol-conversion coding-system 1))
       (if (and
           (or (not rmail-mime-coding-system) (consp rmail-mime-coding-system))
           (not (eq (coding-system-base coding-system) 'us-ascii)))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]