summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBarry Warsaw2014-12-11 21:08:00 -0500
committerBarry Warsaw2014-12-11 21:08:00 -0500
commit930a1c05b441000fbe5c3c4d8ae36d08bfe3dcdd (patch)
tree888744124d2d46dd632eac5d431bdf30b9aa81f7 /src
parent0b3b801e85d858a6fde47254d27985386d753762 (diff)
downloadmailman-930a1c05b441000fbe5c3c4d8ae36d08bfe3dcdd.tar.gz
mailman-930a1c05b441000fbe5c3c4d8ae36d08bfe3dcdd.tar.zst
mailman-930a1c05b441000fbe5c3c4d8ae36d08bfe3dcdd.zip
Diffstat (limited to 'src')
-rw-r--r--src/mailman/utilities/email.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/mailman/utilities/email.py b/src/mailman/utilities/email.py
index a15c86fb5..555fa769e 100644
--- a/src/mailman/utilities/email.py
+++ b/src/mailman/utilities/email.py
@@ -68,7 +68,10 @@ def add_message_hash(msg):
message_id = message_id[1:-1]
else:
message_id = message_id.strip()
+ # Because .digest() returns bytes, b32encode() will return bytes, however
+ # we need a string for the header value. We know the b32encoded byte
+ # string must be ascii-only.
digest = sha1(message_id.encode('utf-8')).digest()
message_id_hash = b32encode(digest)
del msg['x-message-id-hash']
- msg['X-Message-ID-Hash'] = message_id_hash
+ msg['X-Message-ID-Hash'] = message_id_hash.decode('ascii')