summaryrefslogtreecommitdiff
path: root/src/mailman/archiving/prototype.py
diff options
context:
space:
mode:
authortoshio2012-03-14 05:30:52 +0000
committertoshio2012-03-14 05:30:52 +0000
commitd1a9979ecf35d05ed115651dcc6b8680af08b954 (patch)
treecde5caa9a9c20467b4cb3768b564d08e6a368b1a /src/mailman/archiving/prototype.py
parentccde42a936f6c87032c7afd80f33ca5f3fa00b54 (diff)
parentbcc42e2201c7172848185e5675a7b79e3d28aa0f (diff)
downloadmailman-d1a9979ecf35d05ed115651dcc6b8680af08b954.tar.gz
mailman-d1a9979ecf35d05ed115651dcc6b8680af08b954.tar.zst
mailman-d1a9979ecf35d05ed115651dcc6b8680af08b954.zip
Diffstat (limited to 'src/mailman/archiving/prototype.py')
-rw-r--r--src/mailman/archiving/prototype.py18
1 files changed, 5 insertions, 13 deletions
diff --git a/src/mailman/archiving/prototype.py b/src/mailman/archiving/prototype.py
index 266b1da07..be6c60475 100644
--- a/src/mailman/archiving/prototype.py
+++ b/src/mailman/archiving/prototype.py
@@ -63,20 +63,12 @@ class Prototype:
@staticmethod
def permalink(mlist, msg):
"""See `IArchiver`."""
- message_id = msg.get('message-id')
- # It is not the archiver's job to ensure the message has a Message-ID.
- # If this header is missing, there is no permalink.
- if message_id is None:
+ # It is the LMTP server's responsibility to ensure that the message
+ # has a X-Message-ID-Hash header. If it doesn't then there's no
+ # permalink.
+ message_id_hash = msg.get('x-message-id-hash')
+ if message_id_hash is None:
return None
- # The angle brackets are not part of the Message-ID. See RFC 2822.
- if message_id.startswith('<') and message_id.endswith('>'):
- message_id = message_id[1:-1]
- else:
- message_id = message_id.strip()
- digest = hashlib.sha1(message_id).digest()
- message_id_hash = b32encode(digest)
- del msg['x-message-id-hash']
- msg['X-Message-ID-Hash'] = message_id_hash
return urljoin(Prototype.list_url(mlist), message_id_hash)
@staticmethod