GNU bug report logs - #39230
[PATCH] Expand text/html regardless of it position in the MIME tree

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: emacs; Reported by: Jeremy Compostella <jeremy.compostella@HIDDEN>; Keywords: fixed patch; Done: Lars Ingebrigtsen <larsi@HIDDEN>; Maintainer for emacs is bug-gnu-emacs@HIDDEN.
bug marked as fixed in version 28.1, send any further explanations to 39230 <at> debbugs.gnu.org and Jeremy Compostella <jeremy.compostella@HIDDEN> Request was from Lars Ingebrigtsen <larsi@HIDDEN> to control <at> debbugs.gnu.org. Full text available.
Added tag(s) fixed. Request was from Lars Ingebrigtsen <larsi@HIDDEN> to control <at> debbugs.gnu.org. Full text available.

Message received at 39230 <at> debbugs.gnu.org:


Received: (at 39230) by debbugs.gnu.org; 19 Feb 2020 13:52:20 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Feb 19 08:52:20 2020
Received: from localhost ([127.0.0.1]:41808 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1j4Pm0-0007zo-0T
	for submit <at> debbugs.gnu.org; Wed, 19 Feb 2020 08:52:20 -0500
Received: from quimby.gnus.org ([95.216.78.240]:60500)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <larsi@HIDDEN>) id 1j4Plx-0007za-QN
 for 39230 <at> debbugs.gnu.org; Wed, 19 Feb 2020 08:52:18 -0500
Received: from cm-84.212.202.86.getinternet.no ([84.212.202.86] helo=marnie)
 by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.92) (envelope-from <larsi@HIDDEN>)
 id 1j4Plp-0006gM-3x; Wed, 19 Feb 2020 14:52:11 +0100
From: Lars Ingebrigtsen <larsi@HIDDEN>
To: Jeremy Compostella <jeremy.compostella@HIDDEN>
Subject: Re: bug#39230: [PATCH] Expand text/html regardless of it position
 in the MIME tree
References: <878sm05s8b.fsf@HIDDEN>
Date: Wed, 19 Feb 2020 14:52:08 +0100
In-Reply-To: <878sm05s8b.fsf@HIDDEN> (Jeremy Compostella's
 message of "Tue, 21 Jan 2020 16:01:40 -0700")
Message-ID: <87h7zm8z1z.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org",
 has NOT identified this incoming email as spam.  The original
 message has been attached to this so you can view it or label
 similar future email.  If you have any questions, see
 @@CONTACT_ADDRESS@@ for details.
 Content preview:  Jeremy Compostella <jeremy.compostella@HIDDEN> writes:
 > 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. [...] 
 Content analysis details:   (-2.9 points, 5.0 required)
 pts rule name              description
 ---- ---------------------- --------------------------------------------------
 0.0 URIBL_BLOCKED          ADMINISTRATOR NOTICE: The query to URIBL was
 blocked.  See
 http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block
 for more information. [URIs: ingebrigtsen.no]
 -1.0 ALL_TRUSTED            Passed through trusted hosts only via SMTP
 -1.9 BAYES_00               BODY: Bayes spam probability is 0 to 1%
 [score: 0.0000]
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 39230
Cc: 39230 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Jeremy Compostella <jeremy.compostella@HIDDEN> writes:

> 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.

Makes sense.  I've now applied the patch to Emacs 28.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#39230; Package emacs. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 12 Feb 2020 18:18:26 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Feb 12 13:18:26 2020
Received: from localhost ([127.0.0.1]:59018 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1j1waf-0007IO-NP
	for submit <at> debbugs.gnu.org; Wed, 12 Feb 2020 13:18:26 -0500
Received: from lists.gnu.org ([209.51.188.17]:43678)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <jeremy.compostella@HIDDEN>) id 1j1wae-0007IF-26
 for submit <at> debbugs.gnu.org; Wed, 12 Feb 2020 13:18:24 -0500
Received: from eggs.gnu.org ([2001:470:142:3::10]:52202)
 by lists.gnu.org with esmtp (Exim 4.90_1)
 (envelope-from <jeremy.compostella@HIDDEN>) id 1j1wac-0000yQ-7i
 for bug-gnu-emacs@HIDDEN; Wed, 12 Feb 2020 13:18:23 -0500
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org
X-Spam-Level: 
X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50,FREEMAIL_FROM,
 HTML_MESSAGE autolearn=disabled version=3.3.2
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <jeremy.compostella@HIDDEN>) id 1j1waa-0004Hg-Dr
 for bug-gnu-emacs@HIDDEN; Wed, 12 Feb 2020 13:18:22 -0500
Received: from mail-io1-xd44.google.com ([2607:f8b0:4864:20::d44]:43512)
 by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16)
 (Exim 4.71) (envelope-from <jeremy.compostella@HIDDEN>)
 id 1j1waa-0004GL-5c
 for bug-gnu-emacs@HIDDEN; Wed, 12 Feb 2020 13:18:20 -0500
Received: by mail-io1-xd44.google.com with SMTP id n21so3309003ioo.10
 for <bug-gnu-emacs@HIDDEN>; Wed, 12 Feb 2020 10:18:19 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=mime-version:references:in-reply-to:from:date:message-id:subject:to;
 bh=8LNLaceRTFQ+AOQy+oWQh7IRv56Z5+qsVphMUzv0WZg=;
 b=cNkn42EZL12dl/8AuIE0bjApSTuBFQF1Y15t3V9Yy6Hij1qNiauhvJpMBuCzlPLhHQ
 GQfVXMFr228+T4aMfMb6iAByf/YPsKZ6Yu7ZCPgr1IVFwh2B6UhpdhOu41tF8sJBzWHF
 4GRHZBl8HSEV/m0g52X92fwZCk2ziq/2a+yMAV5ItdGUYFX9NcAlEryjtnF7YNH4xlfV
 9JCj+cWUE/cmU1DassB6SDhZOSN1ZAQrS9mVR77NQ/G7f3P8HUz3roHOiZc6KAbaKQP4
 NluqqRm2AJQxhvwHWsRizlv6cpU+cmu8bR+AVcEn1kXGye+KdhR1Gc113+4UHVYYwigM
 vuEg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:mime-version:references:in-reply-to:from:date
 :message-id:subject:to;
 bh=8LNLaceRTFQ+AOQy+oWQh7IRv56Z5+qsVphMUzv0WZg=;
 b=Qca0taFmBUJ0XZdlJt1rT0Zm2mEM7g8bEGcgBsotVCeqB7Buo4zPGgP+SC4SLQIdKd
 PCWMZW2dE0kTP0rH612ef4sPKIR5fby6rCtmXMAxNsH73LzIiOHf/jLWvmKGk9kJuUJd
 jhOLZTZWuk3cqY2AKTzT5EnYqJ/0lnI4IPMYX6l6uK6MR0gYuH8UA9AhLrJS8Kz5PqG4
 tP8iwoaKMNzFjfPp38dZGDoFA3NhqKITrHC3FEWSiILDoO0RMoeolIYo/qRyMbagZN79
 9YEKtlOFo2DgoIrN7djkrrRZ8VV9ndoq3gcM3IQQ5GghY8OfZeULp88D96duxluizlic
 jQTA==
X-Gm-Message-State: APjAAAWChE3BQP+LH0lIpd7UFR7801eWzDRg7f/HLXT90KGp15VAIsID
 E8DVWMzOlCVy++INEivW/rIM6U1u91jOqVOkF8+oKtF7
X-Google-Smtp-Source: APXvYqyqylQgiTtk0qUtcRbVmmajaEtH94RAzbb8aZcXGpcpQJVCo6cR71AQg2oifmBFFh58U4Iqzklcu0RGbnD1OhU=
X-Received: by 2002:a6b:90d6:: with SMTP id
 s205mr19847700iod.138.1581531498687; 
 Wed, 12 Feb 2020 10:18:18 -0800 (PST)
MIME-Version: 1.0
References: <878sm05s8b.fsf@HIDDEN>
In-Reply-To: <878sm05s8b.fsf@HIDDEN>
From: =?UTF-8?B?SsOpcsOpbXkgQ29tcG9zdGVsbGE=?= <jeremy.compostella@HIDDEN>
Date: Wed, 12 Feb 2020 11:18:07 -0700
Message-ID: <CA+TATJExyF6oak-PBn5Je3DAiPdXq4spsz_1D9aiwtR2bjy97g@HIDDEN>
Subject: Re: [PATCH] Expand text/html regardless of it position in the MIME
 tree
To: bug-gnu-emacs@HIDDEN
Content-Type: multipart/mixed; boundary="0000000000002e6c78059e64ff58"
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
 recognized.
X-Received-From: 2607:f8b0:4864:20::d44
X-Spam-Score: 0.3 (/)
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.7 (/)

--0000000000002e6c78059e64ff58
Content-Type: multipart/alternative; boundary="0000000000002e6c75059e64ff56"

--0000000000002e6c75059e64ff56
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

Hi,

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.

Regards,
Jeremy
.

On Tue, Jan 21, 2020 at 4:01 PM Jeremy Compostella <
jeremy.compostella@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=3Dpgpmime>
> and a <part type=3D"text/html" disposition=3Dinline>, the second part is
> not expanded into a multipart related and the images are not included.
>
> Signed-off-by: Jeremy Compostella <jeremy.compostella@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."
>                  (=3D (length cont) 1)
>                  content-type)
>         (setcdr (assq 'type (cdr (car cont))) content-type))
> -      (when (and (consp (car cont))
> -                (=3D (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)))
>        (prog1
>           (with-temp-buffer
>             (set-buffer-multibyte nil)
> @@ -510,6 +507,18 @@ type detected."
>             (buffer-string))
>         (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))
> --
> 2.24.1
>
>

--=20
=C2=AB Si debugger, c'est supprimer des bugs, alors programmer ne peut =C3=
=AAtre que
les ajouter =C2=BB - Edsger Dijkstra

--0000000000002e6c75059e64ff56
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">Hi,<div><br></div><div>I would really appreciate if I coul=
d receive a feedback on this patch.=C2=A0 I can&#39;t send GPG HTML email b=
ecause of this limitation and this is is also blocking an issue reported of=
 my org-msg module.</div><div><br></div><div>I have attached the patch here=
 as I have fixed a typo in the commit headline.</div><div><br></div><div>Le=
t me know if I need to address this patch to another mailing list.</div><di=
v><br></div><div>Regards,</div><div>Jeremy</div><div>.</div></div><br><div =
class=3D"gmail_quote"><div dir=3D"ltr" class=3D"gmail_attr">On Tue, Jan 21,=
 2020 at 4:01 PM Jeremy Compostella &lt;<a href=3D"mailto:jeremy.compostell=
a@HIDDEN">jeremy.compostella@HIDDEN</a>&gt; wrote:<br></div><blockquo=
te class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left:1px =
solid rgb(204,204,204);padding-left:1ex">If the text/html part is not the u=
nique part of the email,<br>
mml-generate-mime does not expand it to a related multipart. This<br>
break uses cases like PGP signing of an HTML email including images.<br>
<br>
For instance, if you compose an email with the &lt;multipart sign=3Dpgpmime=
&gt;<br>
and a &lt;part type=3D&quot;text/html&quot; disposition=3Dinline&gt;, the s=
econd part is<br>
not expanded into a multipart related and the images are not included.<br>
<br>
Signed-off-by: Jeremy Compostella &lt;<a href=3D"mailto:jeremy.compostella@=
gmail.com" target=3D"_blank">jeremy.compostella@HIDDEN</a>&gt;<br>
---<br>
=C2=A0lisp/gnus/mml.el | 19 ++++++++++++++-----<br>
=C2=A01 file changed, 14 insertions(+), 5 deletions(-)<br>
<br>
diff --git a/lisp/gnus/mml.el b/lisp/gnus/mml.el<br>
index cdd8f3d3a5..3d86c5bc40 100644<br>
--- a/lisp/gnus/mml.el<br>
+++ b/lisp/gnus/mml.el<br>
@@ -487,11 +487,8 @@ type detected.&quot;<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(=3D (length =
cont) 1)<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0content-type)=
<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 (setcdr (assq &#39;type (cdr (car cont))) conte=
nt-type))<br>
-=C2=A0 =C2=A0 =C2=A0 (when (and (consp (car cont))<br>
-=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (=3D (length cont)=
 1)<br>
-=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (fboundp &#39;libx=
ml-parse-html-region)<br>
-=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (equal (cdr (assq =
&#39;type (car cont))) &quot;text/html&quot;))<br>
-=C2=A0 =C2=A0 =C2=A0 =C2=A0(setq cont (mml-expand-html-into-multipart-rela=
ted (car cont))))<br>
+=C2=A0 =C2=A0 =C2=A0 (when (fboundp &#39;libxml-parse-html-region)<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0(setq cont (mapcar &#39;mml-expand-all-html-int=
o-multipart-related cont)))<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0(prog1<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (with-temp-buffer<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (set-buffer-multibyte nil)<br>
@@ -510,6 +507,18 @@ type detected.&quot;<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (buffer-string))<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 (setq message-options options)))))<br>
<br>
+(defun mml-expand-all-html-into-multipart-related (cont)<br>
+=C2=A0 (cond ((and (eq (car cont) &#39;part)<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(equal (cdr (assq &#39;typ=
e cont)) &quot;text/html&quot;))<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 (mml-expand-html-into-multipart-related cont))=
<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0((eq (car cont) &#39;multipart)<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 (let ((cur (cdr cont)))<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (while (consp cur)<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (setcar cur (mml-expand-all-html=
-into-multipart-related (car cur)))<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (setf cur (cdr cur))))<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 cont)<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0(t cont)))<br>
+<br>
=C2=A0(defun mml-expand-html-into-multipart-related (cont)<br>
=C2=A0 =C2=A0(let ((new-parts nil)<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 (cid 1))<br>
-- <br>
2.24.1<br>
<br>
</blockquote></div><br clear=3D"all"><div><br></div>-- <br><div dir=3D"ltr"=
 class=3D"gmail_signature">=C2=AB Si debugger, c&#39;est supprimer des bugs=
, alors programmer ne peut =C3=AAtre que les ajouter =C2=BB - Edsger Dijkst=
ra</div>

--0000000000002e6c75059e64ff56--

--0000000000002e6c78059e64ff58
Content-Type: text/x-patch; charset="US-ASCII"; 
	name="0001-Expand-text-html-regardless-of-its-position-in-the-M.patch"
Content-Disposition: attachment; 
	filename="0001-Expand-text-html-regardless-of-its-position-in-the-M.patch"
Content-Transfer-Encoding: base64
Content-ID: <f_k6jn08rg0>
X-Attachment-Id: f_k6jn08rg0

RnJvbSBhM2IyNGJiYzZhNzM4ZTYwYmM3NGRmM2QxMDgyMjE2MWQ3NDJkNDE3IE1vbiBTZXAgMTcg
MDA6MDA6MDAgMjAwMQpGcm9tOiBKZXJlbXkgQ29tcG9zdGVsbGEgPGplcmVteS5jb21wb3N0ZWxs
YUBnbWFpbC5jb20+CkRhdGU6IFR1ZSwgMjEgSmFuIDIwMjAgMTU6NDE6MjIgLTA3MDAKU3ViamVj
dDogW1BBVENIXSBFeHBhbmQgdGV4dC9odG1sIHJlZ2FyZGxlc3Mgb2YgaXRzIHBvc2l0aW9uIGlu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GV0ICgoY3VyIChjZHIgY29udCkpKQorCSAgICh3aGlsZSAoY29uc3AgY3VyKQorCSAgICAg
KHNldGNhciBjdXIgKG1tbC1leHBhbmQtYWxsLWh0bWwtaW50by1tdWx0aXBhcnQtcmVsYXRlZCAo
Y2FyIGN1cikpKQorCSAgICAgKHNldGYgY3VyIChjZHIgY3VyKSkpKQorCSBjb250KQorCSh0IGNv
bnQpKSkKKwogKGRlZnVuIG1tbC1leHBhbmQtaHRtbC1pbnRvLW11bHRpcGFydC1yZWxhdGVkIChj
b250KQogICAobGV0ICgobmV3LXBhcnRzIG5pbCkKIAkoY2lkIDEpKQotLSAKMi4yNC4xCgo=
--0000000000002e6c78059e64ff58--




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#39230; Package emacs. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 21 Jan 2020 23:01:58 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Jan 21 18:01:58 2020
Received: from localhost ([127.0.0.1]:48672 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1iu2Wv-0005Cc-7X
	for submit <at> debbugs.gnu.org; Tue, 21 Jan 2020 18:01:58 -0500
Received: from lists.gnu.org ([209.51.188.17]:43968)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <jeremy.compostella@HIDDEN>) id 1iu2Wo-0005CP-JU
 for submit <at> debbugs.gnu.org; Tue, 21 Jan 2020 18:01:51 -0500
Received: from eggs.gnu.org ([2001:470:142:3::10]:55681)
 by lists.gnu.org with esmtp (Exim 4.90_1)
 (envelope-from <jeremy.compostella@HIDDEN>) id 1iu2Wn-0004lo-9i
 for bug-gnu-emacs@HIDDEN; Tue, 21 Jan 2020 18:01:46 -0500
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org
X-Spam-Level: 
X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50,FREEMAIL_FROM
 autolearn=disabled version=3.3.2
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <jeremy.compostella@HIDDEN>) id 1iu2Wm-0002BE-4T
 for bug-gnu-emacs@HIDDEN; Tue, 21 Jan 2020 18:01:45 -0500
Received: from mail-pl1-x62e.google.com ([2607:f8b0:4864:20::62e]:40943)
 by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16)
 (Exim 4.71) (envelope-from <jeremy.compostella@HIDDEN>)
 id 1iu2Wl-00029R-Uq
 for bug-gnu-emacs@HIDDEN; Tue, 21 Jan 2020 18:01:44 -0500
Received: by mail-pl1-x62e.google.com with SMTP id s21so1997932plr.7
 for <bug-gnu-emacs@HIDDEN>; Tue, 21 Jan 2020 15:01:43 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=from:to:subject:organization:date:message-id:mime-version;
 bh=LmNhniIxMM3BgPPV+Y1VEGkOE46KS9IC10YIG4VGzyc=;
 b=cqPwc13m5B1LFP3fgC32HJkefwpX/hnbODoizQBa1Kq7+wa4Auh1lG5bKSHaWuWD+M
 n/ceP5Tr5WNT0NOCQoJb7B4gKRlhwYNrbhUM3avZZA5QXINkCXfvxyXKU3Reg4nOPvhS
 sZyAgtrphN1zzz8Aw7kj4+JHc5pZegCxrpOIrLl91OZ0SrX+RpkRW0XsNL2txEWbZaIs
 bVSv4bKf/n+mPJ5ztVggF3I02HYm2eBKGbp2hLBY6cAD4KikxTsvMIrWCczEjUYu2nsM
 wcK13eY298UuwNfbfRRzBPmSZCJ71am4HaR+exDrBuusk2GpTJ0oNek/7SR+uNC0wghm
 MbNg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:from:to:subject:organization:date:message-id
 :mime-version;
 bh=LmNhniIxMM3BgPPV+Y1VEGkOE46KS9IC10YIG4VGzyc=;
 b=jfpz4YEk724imZR8vDZMfAB3iRVkT+pqJTY0PKlgrQpGbGGiFiUV4gCUgD1yncnnRJ
 2It/JgQMCWMHBhtJdVPl1BuPguNeqSVQuA8GHDTlBaRbxHuxtzfkOPgivSTDkA3yfgqU
 /y94fQeEL7RNewwMt1wvtv+tQRrXEsfiQdoxnr18uz++VlLwbZeJIvrMrc1dK4p8Fw66
 JVneXj8R0VGtthfniQtdWmAg8S40VwlML6YSclecAC2IsRRmziJcORUh22mQU0pookc/
 2XkyuLOoK1hcz3Q6UWYKjn05E9TKcjR+tfX++nZN6YK1gzP9e6qIJUKS4xQFqoqK6Oaw
 6czg==
X-Gm-Message-State: APjAAAXjKTn3deVYIbE8BEkafhWGwNbzueYgldCyppOuPx0usCdPYF4x
 jlYYovTx3O4vD43Y6fYPs0c=
X-Google-Smtp-Source: APXvYqxdjtzHmSjKQBdUVINvUQ+2RdJVy3h9ravDGh56YQPpnAwpdv6dBqv2K9L4otkKecIokxlYZg==
X-Received: by 2002:a17:90b:3cc:: with SMTP id
 go12mr864483pjb.89.1579647702419; 
 Tue, 21 Jan 2020 15:01:42 -0800 (PST)
Received: from jcompost-mobl.ch.intel.com (fmdmzpr04-ext.fm.intel.com.
 [192.55.55.39])
 by smtp.gmail.com with ESMTPSA id w11sm41813844pgs.60.2020.01.21.15.01.41
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Tue, 21 Jan 2020 15:01:41 -0800 (PST)
From: Jeremy Compostella <jeremy.compostella@HIDDEN>
To: <bug-gnu-emacs@HIDDEN>
Subject: [PATCH] Expand text/html regardless of it position in the MIME tree
Organization: Intel Corportation - 2200 Mission College Blvd. Santa Clara, CA
 95052. USA
Date: Tue, 21 Jan 2020 16:01:40 -0700
Message-ID: <878sm05s8b.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
 recognized.
X-Received-From: 2607:f8b0:4864:20::62e
X-Spam-Score: 0.7 (/)
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -2.3 (--)

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 <jeremy.compostella@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)
 		 content-type)
 	(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)))
       (prog1
 	  (with-temp-buffer
 	    (set-buffer-multibyte nil)
@@ -510,6 +507,18 @@ type detected."
 	    (buffer-string))
 	(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))
-- 
2.24.1





Acknowledgement sent to Jeremy Compostella <jeremy.compostella@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs@HIDDEN. Full text available.
Report forwarded to bug-gnu-emacs@HIDDEN:
bug#39230; Package emacs. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Wed, 19 Feb 2020 14:00:02 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.