aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Kahn Gillmor <dkg@fifthhorseman.net>2019-12-24 17:05:44 -0500
committerDavid Bremner <david@tethera.net>2020-01-08 21:09:21 -0400
commit5aa60342c86b163848bca6882f34821d4871b849 (patch)
tree851740830155044606448c90abfa2e98b8db1a5e
parentcedc6db19d2bb37ce0c8f74be25cdf045b35caca (diff)
legacy-display: accept text/plain legacy display parts
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@fifthhorseman.net>
-rw-r--r--util/repair.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/util/repair.c b/util/repair.c
index 9fba97b7..f5cbb14b 100644
--- a/util/repair.c
+++ b/util/repair.c
@@ -49,8 +49,14 @@ _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"))
+ /* Early implementations that generated "Legacy Display" parts used
+ Content-Type: text/rfc822-headers, but text/plain is more widely
+ rendered, so it is now the standard choice. We accept either as a
+ Legacy Display part. */
+ 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")))
return false;
protected_header_parameter = g_mime_object_get_content_type_parameter (first, "protected-headers");
if ((! protected_header_parameter) || strcmp (protected_header_parameter, "v1"))