[PATCH 5/6] cli/{show,reply}: skip over legacy-display parts
Daniel Kahn Gillmor
dkg at fifthhorseman.net
Thu May 30 21:28:24 PDT 2019
Make use of the previous changes to fast-forward past any
legacy-display parts during "notmuch show" and "notmuch reply".
Signed-off-by: Daniel Kahn Gillmor <dkg at fifthhorseman.net>
---
mime-node.c | 9 ++++++++-
test/T356-protected-headers.sh | 2 --
2 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/mime-node.c b/mime-node.c
index b8143b27..a1a9db29 100644
--- a/mime-node.c
+++ b/mime-node.c
@@ -329,7 +329,14 @@ _mime_node_create (mime_node_t *parent, GMimeObject *part, int numchild)
node_verify (node, part);
}
} else {
- _notmuch_message_crypto_potential_payload (node->ctx->msg_crypto, part, parent ? parent->part : NULL, numchild);
+ if (_notmuch_message_crypto_potential_payload (node->ctx->msg_crypto, part, parent ? parent->part : NULL, numchild) &&
+ node->ctx->msg_crypto->decryption_status == NOTMUCH_MESSAGE_DECRYPTED_FULL) {
+ GMimeObject *clean_payload = _notmuch_crypto_payload_skip_legacy_display (part);
+ if (clean_payload != part) {
+ if (! _mime_node_set_up_part (node, clean_payload))
+ fprintf (stderr, "Error: failed to skip legacy display part\n");
+ }
+ }
}
return node;
diff --git a/test/T356-protected-headers.sh b/test/T356-protected-headers.sh
index aeee3493..af0b686b 100755
--- a/test/T356-protected-headers.sh
+++ b/test/T356-protected-headers.sh
@@ -137,14 +137,12 @@ id:protected-header at crypto.notmuchmail.org
id:subjectless-protected-header at crypto.notmuchmail.org'
test_begin_subtest "When rendering protected headers, avoid rendering legacy-display part"
-test_subtest_known_broken
output=$(notmuch show --format=json id:protected-with-legacy-display at crypto.notmuchmail.org)
test_json_nodes <<<"$output" \
'subject:[0][0][0]["headers"]["Subject"]="Interrupting Cow"' \
'no_legacy_display:[0][0][0]["body"][0]["content"][1]["content-type"]="text/plain"'
test_begin_subtest "When replying, avoid rendering legacy-display part"
-test_subtest_known_broken
output=$(notmuch reply --format=json id:protected-with-legacy-display at crypto.notmuchmail.org)
test_json_nodes <<<"$output" \
'no_legacy_display:["original"]["body"][0]["content"][1]["content-type"]="text/plain"'
--
2.20.1
More information about the notmuch
mailing list