aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/mailman_pgp/pgp/mime.py14
-rw-r--r--src/mailman_pgp/pgp/utils.py2
2 files changed, 12 insertions, 4 deletions
diff --git a/src/mailman_pgp/pgp/mime.py b/src/mailman_pgp/pgp/mime.py
index f3993a9..02306b4 100644
--- a/src/mailman_pgp/pgp/mime.py
+++ b/src/mailman_pgp/pgp/mime.py
@@ -99,7 +99,7 @@ class MIMEWrapper:
def is_keys(self):
for part in walk(self.msg):
if (not part.is_multipart()
- and part.get_content_type() != MIMEWrapper._keys_type):
+ and part.get_content_type() != MIMEWrapper._keys_type):
return False
return True
@@ -112,7 +112,7 @@ class MIMEWrapper:
"""
for part in walk(self.msg):
if (not part.is_multipart()
- and part.get_content_type() == MIMEWrapper._keys_type):
+ and part.get_content_type() == MIMEWrapper._keys_type):
return True
return False
@@ -124,7 +124,7 @@ class MIMEWrapper:
"""
for part in walk(self.msg):
if (not part.is_multipart()
- and part.get_content_type() == MIMEWrapper._keys_type):
+ and part.get_content_type() == MIMEWrapper._keys_type):
key, _ = PGPKey.from_blob(part.get_payload())
yield key
@@ -175,7 +175,13 @@ class MIMEWrapper:
second_part = MIMEApplication(_data=str(signature),
_subtype=MIMEWrapper._signature_subtype,
- _encoder=encode_7or8bit)
+ _encoder=encode_7or8bit,
+ name='signature.asc')
+ second_part.add_header('content-description',
+ 'OpenPGP digital signature')
+ second_part.add_header('content-disposition', 'attachment',
+ filename='signature.asc')
+
out.attach(copy.deepcopy(self.msg))
out.attach(second_part)
copy_headers(self.msg, out)
diff --git a/src/mailman_pgp/pgp/utils.py b/src/mailman_pgp/pgp/utils.py
index 1701c63..cc0bda0 100644
--- a/src/mailman_pgp/pgp/utils.py
+++ b/src/mailman_pgp/pgp/utils.py
@@ -20,3 +20,5 @@ def copy_headers(from_msg, to_msg):
for key, value in from_msg.items():
if key not in to_msg:
to_msg[key] = value
+ if to_msg.get_unixfrom() is None:
+ to_msg.set_unixfrom(from_msg.get_unixfrom())