When we notice a legacy-display part during indexing, it makes more sense to avoid indexing it as part of the message body.
Given that the protected subject will already be indexed, there is no need to index this part at all, so we skip over it. Signed-off-by: Daniel Kahn Gillmor <d...@fifthhorseman.net> --- lib/index.cc | 14 ++++++++++---- test/T356-protected-headers.sh | 1 - 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/lib/index.cc b/lib/index.cc index deb76f6f..d3f21f91 100644 --- a/lib/index.cc +++ b/lib/index.cc @@ -433,8 +433,11 @@ _index_mime_part (notmuch_message_t *message, continue; } child = g_mime_multipart_get_part (multipart, i); - _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_crypto_payload_skip_legacy_display (child); + _index_mime_part (message, indexopts, toindex, msg_crypto); } return; } @@ -572,8 +575,11 @@ _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_crypto_payload_skip_legacy_display (clear); + _index_mime_part (message, indexopts, toindex, msg_crypto); g_object_unref (clear); status = notmuch_message_add_property (message, "index.decryption", "success"); diff --git a/test/T356-protected-headers.sh b/test/T356-protected-headers.sh index af0b686b..295e3750 100755 --- a/test/T356-protected-headers.sh +++ b/test/T356-protected-headers.sh @@ -148,7 +148,6 @@ test_json_nodes <<<"$output" \ 'no_legacy_display:["original"]["body"][0]["content"][1]["content-type"]="text/plain"' test_begin_subtest "do not treat legacy-display part as body when indexing" -test_subtest_known_broken output=$(notmuch search --output=messages body:interrupting) test_expect_equal "$output" '' -- 2.20.1 _______________________________________________ notmuch mailing list notmuch@notmuchmail.org https://notmuchmail.org/mailman/listinfo/notmuch