From 0d9cddb82f969fbcd4e1c619c69ef731b231f0ff Mon Sep 17 00:00:00 2001 From: Lars Magne Ingebrigtsen Date: Tue, 12 Oct 2010 23:32:19 +0200 Subject: [PATCH] * rfc2231.el (rfc2231-parse-string): Ignore repeated parts. The test case is: (rfc2231-parse-qp-string "Content-Type: application/x-pkcs7-mime;smime-type=signed-data;name=smime.p7m; smime-type=signed-data; name=\"smime.p7m\"") This used to return name=smime.p7msmime.p7m, which isn't very helpful. --- lisp/ChangeLog | 2 ++ lisp/rfc2231.el | 18 +++++++++++++----- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 0eba77ed0..d44febae5 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,5 +1,7 @@ 2010-10-12 Lars Magne Ingebrigtsen + * rfc2231.el (rfc2231-parse-string): Ignore repeated parts. + * nnimap.el (nnimap-request-rename-group): Unselect by selecting a mailbox that doesn't exist. diff --git a/lisp/rfc2231.el b/lisp/rfc2231.el index 7cb1740c6..0b028a08b 100644 --- a/lisp/rfc2231.el +++ b/lisp/rfc2231.el @@ -185,11 +185,19 @@ must never cause a Lisp error." in (sort parameters (lambda (e1 e2) (< (or (caddr e1) 0) (or (caddr e2) 0)))) - do (if (or (not (setq elem (assq attribute cparams))) - (and (numberp part) - (zerop part))) - (push (list attribute value encoded) cparams) - (setcar (cdr elem) (concat (cadr elem) value)))) + do (cond + ;; First part. + ((or (not (setq elem (assq attribute cparams))) + (and (numberp part) + (zerop part))) + (push (list attribute value encoded) cparams)) + ;; Repetition of a part; do nothing. + ((and elem + (null number)) + ) + ;; Concatenate continuation parts. + (t + (setcar (cdr elem) (concat (cadr elem) value))))) ;; Finally decode encoded values. (cons type (mapcar (lambda (elem) -- 2.25.1