X-Git-Url: https://git.notmuchmail.org/git?p=notmuch;a=blobdiff_plain;f=lib%2Findex.cc;fp=lib%2Findex.cc;h=1301d78a045a09d1272cbf9c81f5b4022b3ea94d;hp=08cc84e23c8e08628b25a7bd5d44b2ce6af3cb7b;hb=9829533e92f84ff151279e5202e0420bc70a8863;hpb=c61e22d5cb9a7e5b03f9fcdb9911b4b4a641af2b diff --git a/lib/index.cc b/lib/index.cc index 08cc84e2..1301d78a 100644 --- a/lib/index.cc +++ b/lib/index.cc @@ -435,8 +435,14 @@ _index_mime_part (notmuch_message_t *message, continue; } child = g_mime_multipart_get_part (multipart, i); - (void) _notmuch_message_crypto_potential_payload (msg_crypto, child, part, i); - _index_mime_part (message, indexopts, child, msg_crypto); + GMimeObject *toindex = child; + if (_notmuch_message_crypto_potential_payload (msg_crypto, child, part, i) && + msg_crypto->decryption_status == NOTMUCH_MESSAGE_DECRYPTED_FULL) { + toindex = _notmuch_repair_crypto_payload_skip_legacy_display (child); + if (toindex != child) + notmuch_message_add_property (message, "index.repaired", "skip-protected-headers-legacy-display"); + } + _index_mime_part (message, indexopts, toindex, msg_crypto); } return; } @@ -573,8 +579,14 @@ _index_encrypted_mime_part (notmuch_message_t *message, } g_object_unref (decrypt_result); } - _notmuch_message_crypto_potential_payload (msg_crypto, clear, GMIME_OBJECT (encrypted_data), GMIME_MULTIPART_ENCRYPTED_CONTENT); - _index_mime_part (message, indexopts, clear, msg_crypto); + GMimeObject *toindex = clear; + if (_notmuch_message_crypto_potential_payload (msg_crypto, clear, GMIME_OBJECT (encrypted_data), GMIME_MULTIPART_ENCRYPTED_CONTENT) && + msg_crypto->decryption_status == NOTMUCH_MESSAGE_DECRYPTED_FULL) { + toindex = _notmuch_repair_crypto_payload_skip_legacy_display (clear); + if (toindex != clear) + notmuch_message_add_property (message, "index.repaired", "skip-protected-headers-legacy-display"); + } + _index_mime_part (message, indexopts, toindex, msg_crypto); g_object_unref (clear); status = notmuch_message_add_property (message, "index.decryption", "success");