From c00930e9be1c9ce679ac1a214615adae69c6ede4 Mon Sep 17 00:00:00 2001 From: Andrew Engelbrecht Date: Thu, 10 Dec 2015 17:44:54 -0500 Subject: [PATCH] don't quote attachments this patch improve output sanitization --- edward | 11 ++++++++--- tests/gpg-flatten-2.out | 1 - 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/edward b/edward index c5ad72f..ba4b947 100755 --- a/edward +++ b/edward @@ -92,8 +92,9 @@ class EddyMsg (object): 'payload_pieces' is a list of objects containing strings that when strung together form the fully-decoded string representation of the mime part. - The 'filename', 'content_type' and 'description_list' come from the mime - part parameters. + The 'filename', 'content_type', 'content_disposition' and + 'description_list' come from the mime part parameters. + """ multipart = False @@ -104,6 +105,7 @@ class EddyMsg (object): filename = None content_type = None + content_disposition = None description_list = None @@ -460,6 +462,7 @@ def get_subpart_data (part): obj.filename = part.get_filename() obj.content_type = part.get_content_type() + obj.content_disposition = part['content-disposition'] obj.description_list = part['content-description'] if mime_decoded_bytes != None: @@ -889,7 +892,9 @@ def flatten_decrypted_payloads (eddymsg_obj, replyinfo_obj, get_signed_part): replyinfo_obj.target_key = piece.gpg_data.sigs[0] break else: - if piece.piece_type == TxtType.text: + if (eddymsg_obj.content_disposition == None \ + or not eddymsg_obj.content_disposition.startswith("attachment")) \ + and piece.piece_type == TxtType.text: replyinfo_obj.msg_to_quote += piece.string diff --git a/tests/gpg-flatten-2.out b/tests/gpg-flatten-2.out index 1ffc9fa..6830350 100644 --- a/tests/gpg-flatten-2.out +++ b/tests/gpg-flatten-2.out @@ -17,7 +17,6 @@ I received your message and decrypted it. Here's a copy of your message: > > > -> Your signature was verified. -- 2.25.1