[PATCH 1/2] legacy-display: accept text/plain legacy display parts

David Edmondson dme at dme.org
Tue Dec 24 02:59:09 PST 2019


On Monday, 2019-12-23 at 12:39:26 -05, Daniel Kahn Gillmor wrote:

> https://www.ietf.org/id/draft-autocrypt-lamps-protected-headers-02.html
> Makes it clear that the "Legacy Display" part of an encrypted message
> with protected headers can (and indeed, should) be of content-type
> text/plain, though some clients still generate the Legacy Display part
> as content-type text/rfc822-headers.  Notmuch should recognize the
> part whichever of the two content-types it uses.
>
> See also discussion in
> https://github.com/autocrypt/protected-headers/issues/23 for why the
> community of implementers is moving in the direction of text/plain.
>
> Signed-off-by: Daniel Kahn Gillmor <dkg at fifthhorseman.net>
> ---
>  util/repair.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/util/repair.c b/util/repair.c
> index 9fba97b7..4385d16f 100644
> --- a/util/repair.c
> +++ b/util/repair.c
> @@ -49,8 +49,10 @@ _notmuch_crypto_payload_has_legacy_display (GMimeObject *payload)
>      if (g_mime_multipart_get_count (mpayload) != 2)
>  	return false;
>      first = g_mime_multipart_get_part (mpayload, 0);
> -    if (! g_mime_content_type_is_type (g_mime_object_get_content_type (first),
> -				       "text", "rfc822-headers"))
> +    if (! (g_mime_content_type_is_type (g_mime_object_get_content_type (first),
> +					"text", "plain") ||
> +	   g_mime_content_type_is_type (g_mime_object_get_content_type (first),
> +					"text", "rfc822-headers")))

Patch looks good, though I would quite like there to be a comment in the
code. Something simple like:

/* text/rfc822-headers was replaced by text/plain as the MIME type for
“Legacy Display” parts - we allow either. */

>  	return false;
>      protected_header_parameter = g_mime_object_get_content_type_parameter (first, "protected-headers");
>      if ((! protected_header_parameter) || strcmp (protected_header_parameter, "v1"))
> -- 
> 2.24.0
>
> _______________________________________________
> notmuch mailing list
> notmuch at notmuchmail.org
> https://notmuchmail.org/mailman/listinfo/notmuch

dme.
-- 
It's alright, we told you what to dream.


More information about the notmuch mailing list