[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#39230: [PATCH] Expand text/html regardless of it position in the MIM

From: Jérémy Compostella
Subject: bug#39230: [PATCH] Expand text/html regardless of it position in the MIME tree
Date: Wed, 12 Feb 2020 11:18:07 -0700


I would really appreciate if I could receive a feedback on this patch.  I can't send GPG HTML email because of this limitation and this is is also blocking an issue reported of my org-msg module.

I have attached the patch here as I have fixed a typo in the commit headline.

Let me know if I need to address this patch to another mailing list.


On Tue, Jan 21, 2020 at 4:01 PM Jeremy Compostella <address@hidden> wrote:
If the text/html part is not the unique part of the email,
mml-generate-mime does not expand it to a related multipart. This
break uses cases like PGP signing of an HTML email including images.

For instance, if you compose an email with the <multipart sign=pgpmime>
and a <part type="text/html" disposition=inline>, the second part is
not expanded into a multipart related and the images are not included.

Signed-off-by: Jeremy Compostella <address@hidden>
 lisp/gnus/mml.el | 19 ++++++++++++++-----
 1 file changed, 14 insertions(+), 5 deletions(-)

diff --git a/lisp/gnus/mml.el b/lisp/gnus/mml.el
index cdd8f3d3a5..3d86c5bc40 100644
--- a/lisp/gnus/mml.el
+++ b/lisp/gnus/mml.el
@@ -487,11 +487,8 @@ type detected."
                 (= (length cont) 1)
        (setcdr (assq 'type (cdr (car cont))) content-type))
-      (when (and (consp (car cont))
-                (= (length cont) 1)
-                (fboundp 'libxml-parse-html-region)
-                (equal (cdr (assq 'type (car cont))) "text/html"))
-       (setq cont (mml-expand-html-into-multipart-related (car cont))))
+      (when (fboundp 'libxml-parse-html-region)
+       (setq cont (mapcar 'mml-expand-all-html-into-multipart-related cont)))
            (set-buffer-multibyte nil)
@@ -510,6 +507,18 @@ type detected."
        (setq message-options options)))))

+(defun mml-expand-all-html-into-multipart-related (cont)
+  (cond ((and (eq (car cont) 'part)
+             (equal (cdr (assq 'type cont)) "text/html"))
+        (mml-expand-html-into-multipart-related cont))
+       ((eq (car cont) 'multipart)
+        (let ((cur (cdr cont)))
+          (while (consp cur)
+            (setcar cur (mml-expand-all-html-into-multipart-related (car cur)))
+            (setf cur (cdr cur))))
+        cont)
+       (t cont)))
 (defun mml-expand-html-into-multipart-related (cont)
   (let ((new-parts nil)
        (cid 1))

« Si debugger, c'est supprimer des bugs, alors programmer ne peut être que les ajouter » - Edsger Dijkstra

Attachment: 0001-Expand-text-html-regardless-of-its-position-in-the-M.patch
Description: Text Data

reply via email to

[Prev in Thread] Current Thread [Next in Thread]