From 9c348860af3d943c4290ce717b95775e1a799792 Mon Sep 17 00:00:00 2001 From: Andrew Engelbrecht Date: Mon, 30 Nov 2015 16:45:37 -0500 Subject: [PATCH] convert isolated or -> this is for the sake of proper signature verification. sometimes mail servers strip s from the ends of lines. however these characters are required by RFC 3156 for proper signature verification. --- edward | 4 +++- tests/gpg-flatten-5.eml | 10 +++++----- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/edward b/edward index 2480fcd..1622e42 100755 --- a/edward +++ b/edward @@ -454,7 +454,9 @@ def get_subpart_data (part): payload_string = part.as_string() if payload_string != None: - obj.payload_bytes = payload_string.encode(charset) + # convert each isolated carriage return or line feed to carriage return + line feed + payload_string_crlf = re.sub(r'\n', '\r\n', re.sub(r'\r', '\n', re.sub(r'\r\n', '\n', payload_string))) + obj.payload_bytes = payload_string_crlf.encode(charset) obj.filename = part.get_filename() obj.content_type = part.get_content_type() diff --git a/tests/gpg-flatten-5.eml b/tests/gpg-flatten-5.eml index 3478335..8eddb45 100644 --- a/tests/gpg-flatten-5.eml +++ b/tests/gpg-flatten-5.eml @@ -41,11 +41,11 @@ Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 -iJwEAAECAAYFAlXBO+cACgkQsT5tL2pPbujZbgQAhF23ts0wohA6lxbVfcq/mdzl -GrRO7pYC5BNDtRRjeGDCOisdfY5qK0skuwVSSMJAKok+Sgv/FKsofWT08XPBz4vV -KAtJoAb6i6r8g38lHGM1Fl8POK3tAEC0srf45xBJY14yuJoGMC0rG+Hj+IxtFfay -Fphd1bTfkcXjEZN8/nA= -=HfPl +iJwEAAECAAYFAlZcv6cACgkQsT5tL2pPbuiVHAP/fl0fViiYtc5UHAOzywlTRKP0 +DXCp4mgwkeqawaC4+N7CN1I4dezoWBoKcOBJRuF6rrkeet7vsj8FeJAvzBTui6PI +XxGPU4wuaaQ0R9DlePqKPzScrDEBXvxvJdk9AUilkiU3/jaCsgpalAaLrwK4PCIL +iXisvPWXi2u7tSPpJWU= +=GWbS -----END PGP SIGNATURE----- --69pEqCNMs7DnfdpwkAdpUCaf0lwnKu6Vr-- -- 2.25.1