From 4f9a9bcacfb7b260f0053324bf022e4b14f65155 Mon Sep 17 00:00:00 2001 From: yamaoka Date: Sat, 31 Jan 2004 23:48:23 +0000 Subject: [PATCH] Synch to No Gnus 200401312128. --- lisp/ChangeLog | 5 +++++ lisp/rfc2047.el | 14 +++++++++----- 2 files changed, 14 insertions(+), 5 deletions(-) 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. -- 1.7.10.4