* rfc2231.el (rfc2231-parse-string): Ignore repeated parts.
authorLars Magne Ingebrigtsen <larsi@quimbies.gnus.org>
Tue, 12 Oct 2010 21:32:19 +0000 (23:32 +0200)
committerLars Magne Ingebrigtsen <larsi@quimbies.gnus.org>
Tue, 12 Oct 2010 21:32:19 +0000 (23:32 +0200)
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
lisp/rfc2231.el

index 0eba77e..d44feba 100644 (file)
@@ -1,5 +1,7 @@
 2010-10-12  Lars Magne Ingebrigtsen  <larsi@gnus.org>
 
+       * rfc2231.el (rfc2231-parse-string): Ignore repeated parts.
+
        * nnimap.el (nnimap-request-rename-group): Unselect by selecting a
        mailbox that doesn't exist.
 
index 7cb1740..0b028a0 100644 (file)
@@ -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)