From: yamaoka Date: Sat, 31 Jan 2004 23:48:23 +0000 (+0000) Subject: Synch to No Gnus 200401312128. X-Git-Tag: t-gnus-6_17_4-quimby-~1091 X-Git-Url: http://git.chise.org/gitweb/?a=commitdiff_plain;h=4f9a9bcacfb7b260f0053324bf022e4b14f65155;p=elisp%2Fgnus.git- Synch to No Gnus 200401312128. --- diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 2d7688b..1baec53 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2004-01-31 Jesper Harder + + * rfc2047.el (rfc2047-pad-base64): Deal with more cases of invalid + padding. + 2004-01-27 Simon Josefsson * mm-view.el (mm-fill-flowed): Add. diff --git a/lisp/rfc2047.el b/lisp/rfc2047.el index 45ad717..0cbb732 100644 --- a/lisp/rfc2047.el +++ b/lisp/rfc2047.el @@ -704,11 +704,15 @@ decodable." ;; Be more liberal to accept buggy base64 strings. If ;; base64-decode-string accepts buggy strings, this function could ;; be aliased to identity. - (case (mod (length string) 4) - (0 string) - (1 string) ;; Error, don't pad it. - (2 (concat string "==")) - (3 (concat string "=")))) + (if (= 0 (mod (length string) 4)) + string + (when (string-match "=+$" string) + (setq string (substring string 0 (match-beginning 0)))) + (case (mod (length string) 4) + (0 string) + (1 string) ;; Error, don't pad it. + (2 (concat string "==")) + (3 (concat string "="))))) (defun rfc2047-decode (charset encoding string) "Decode STRING from the given MIME CHARSET in the given ENCODING.