changeset 76916:31c4e5bc7e74

(rmail-convert-to-babyl-format): Don't try to decode base-64 encoded body if its content-type is something other than text/* or message/*.
author Eli Zaretskii <eliz@gnu.org>
date Tue, 03 Apr 2007 11:11:27 +0000
parents b5f8f04cdee4
children 4b93b4ef75ad
files lisp/mail/rmail.el
diffstat 1 files changed, 17 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/mail/rmail.el	Tue Apr 03 11:10:09 2007 +0000
+++ b/lisp/mail/rmail.el	Tue Apr 03 11:11:27 2007 +0000
@@ -1959,9 +1959,13 @@
 			(base64-header-field-end
 			 (save-excursion
 			   (goto-char start)
-			   (re-search-forward
-			    "^content-transfer-encoding:\\(\n?[\t ]\\)*base64\\(\n?[\t ]\\)*"
-			    header-end t))))
+			   (and (re-search-forward
+				 "^content-transfer-encoding:\\(\n?[\t ]\\)*base64\\(\n?[\t ]\\)*"
+				 header-end t)
+				;; Don't try to decode non-text data.
+				(re-search-forward
+				 "^content-type:\\(\n?[\t ]\\)\\(text\\|message\\)/"
+				 header-end t)))))
 		   (if quoted-printable-header-field-end
 		       (save-excursion
 			 (unless
@@ -2061,10 +2065,16 @@
 			  "^content-transfer-encoding:\\(\n?[\t ]\\)*quoted-printable\\(\n?[\t ]\\)*"
 			  header-end t)))
 		      (base64-header-field-end
-		       (save-excursion
-			 (re-search-forward
-			  "^content-transfer-encoding:\\(\n?[\t ]\\)*base64\\(\n?[\t ]\\)*"
-			  header-end t)))
+		       (and
+			(save-excursion
+			  (re-search-forward
+			   "^content-transfer-encoding:\\(\n?[\t ]\\)*base64\\(\n?[\t ]\\)*"
+			   header-end t))
+			;; Don't decode non-text data.
+			(save-excursion
+			  (re-search-forward
+			   "^content-type:\\(\n?[\t ]\\)\\(text\\|message\\)/"
+			   header-end t))))
 		      (size
 		       ;; Get the numeric value from the Content-Length field.
 		       (save-excursion