]> git.notmuchmail.org Git - notmuch/commitdiff
cli/{show,reply}: skip over legacy-display parts
authorDaniel Kahn Gillmor <dkg@fifthhorseman.net>
Thu, 29 Aug 2019 15:38:52 +0000 (11:38 -0400)
committerDavid Bremner <david@tethera.net>
Sun, 1 Sep 2019 11:44:17 +0000 (08:44 -0300)
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@fifthhorseman.net>
mime-node.c
test/T356-protected-headers.sh

index abb6dd8432bbb4c9e54ec325c5fa6862b7032063..599d3b65e4176598f3376ba0eaf9cbdfd5c32533 100644 (file)
@@ -333,7 +333,16 @@ _mime_node_set_up_part (mime_node_t *node, GMimeObject *part, int numchild)
            node_verify (node, part);
        }
     } else {
-       (void) _notmuch_message_crypto_potential_payload (node->ctx->msg_crypto, part, node->parent ? node->parent->part : NULL, numchild);
+       if (_notmuch_message_crypto_potential_payload (node->ctx->msg_crypto, part, node->parent ? node->parent->part : NULL, numchild) &&
+           node->ctx->msg_crypto->decryption_status == NOTMUCH_MESSAGE_DECRYPTED_FULL) {
+           GMimeObject *clean_payload = _notmuch_repair_crypto_payload_skip_legacy_display (part);
+           if (clean_payload != part) {
+               /* only one layer of recursion is possible here
+                * because there can be only a single cryptographic
+                * payload: */
+               return _mime_node_set_up_part (node, clean_payload, numchild);
+           }
+       }
     }
 
     return true;
index 43dfffe696d2858e9ad0400156596e701c4f153e..867b8722be11c505557e3497e94f34482f57bbc3 100755 (executable)
@@ -137,14 +137,12 @@ id:protected-header@crypto.notmuchmail.org
 id:subjectless-protected-header@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@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@crypto.notmuchmail.org)
 test_json_nodes <<<"$output" \
                 'no_legacy_display:["original"]["body"][0]["content"][1]["content-type"]="text/plain"'