aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeremy Compostella2020-02-19 14:51:43 +0100
committerLars Ingebrigtsen2020-02-19 14:51:43 +0100
commite1e1bd8f85c53fea9f61b6ec99b461ddd93461b9 (patch)
tree8983fc9eee3d1c075fa1450128994cf9fac43451
parentb3de1302ca347b95fe6aa2608aba550292d32353 (diff)
downloademacs-e1e1bd8f85c53fea9f61b6ec99b461ddd93461b9.tar.gz
emacs-e1e1bd8f85c53fea9f61b6ec99b461ddd93461b9.zip
Fix conversion of text/html->multipart/related
* lisp/gnus/mml.el (mml-expand-all-html-into-multipart-related): New function (bug#39230). (mml-generate-mime): Use it to expand all HTML parts, no matter where in the MIME tree.
-rw-r--r--lisp/gnus/mml.el19
1 files changed, 14 insertions, 5 deletions
diff --git a/lisp/gnus/mml.el b/lisp/gnus/mml.el
index cdd8f3d3a50..3d86c5bc407 100644
--- a/lisp/gnus/mml.el
+++ b/lisp/gnus/mml.el
@@ -487,11 +487,8 @@ type detected."
487 (= (length cont) 1) 487 (= (length cont) 1)
488 content-type) 488 content-type)
489 (setcdr (assq 'type (cdr (car cont))) content-type)) 489 (setcdr (assq 'type (cdr (car cont))) content-type))
490 (when (and (consp (car cont)) 490 (when (fboundp 'libxml-parse-html-region)
491 (= (length cont) 1) 491 (setq cont (mapcar 'mml-expand-all-html-into-multipart-related cont)))
492 (fboundp 'libxml-parse-html-region)
493 (equal (cdr (assq 'type (car cont))) "text/html"))
494 (setq cont (mml-expand-html-into-multipart-related (car cont))))
495 (prog1 492 (prog1
496 (with-temp-buffer 493 (with-temp-buffer
497 (set-buffer-multibyte nil) 494 (set-buffer-multibyte nil)
@@ -510,6 +507,18 @@ type detected."
510 (buffer-string)) 507 (buffer-string))
511 (setq message-options options))))) 508 (setq message-options options)))))
512 509
510(defun mml-expand-all-html-into-multipart-related (cont)
511 (cond ((and (eq (car cont) 'part)
512 (equal (cdr (assq 'type cont)) "text/html"))
513 (mml-expand-html-into-multipart-related cont))
514 ((eq (car cont) 'multipart)
515 (let ((cur (cdr cont)))
516 (while (consp cur)
517 (setcar cur (mml-expand-all-html-into-multipart-related (car cur)))
518 (setf cur (cdr cur))))
519 cont)
520 (t cont)))
521
513(defun mml-expand-html-into-multipart-related (cont) 522(defun mml-expand-html-into-multipart-related (cont)
514 (let ((new-parts nil) 523 (let ((new-parts nil)
515 (cid 1)) 524 (cid 1))