summaryrefslogtreecommitdiff
path: root/src/mailman/archiving/mailarchive.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/mailman/archiving/mailarchive.py')
-rw-r--r--src/mailman/archiving/mailarchive.py22
1 files changed, 5 insertions, 17 deletions
diff --git a/src/mailman/archiving/mailarchive.py b/src/mailman/archiving/mailarchive.py
index 29c0e22c2..c72cde11c 100644
--- a/src/mailman/archiving/mailarchive.py
+++ b/src/mailman/archiving/mailarchive.py
@@ -25,9 +25,6 @@ __all__ = [
]
-import hashlib
-
-from base64 import urlsafe_b64encode
from urllib import quote
from urlparse import urljoin
from zope.interface import implements
@@ -60,21 +57,12 @@ class MailArchive:
"""See `IArchiver`."""
if mlist.archive_private:
return None
- message_id = msg.get('message-id')
- # It is not the archiver's job to ensure the message has a Message-ID.
- # If no Message-ID is available, 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()
- sha = hashlib.sha1(message_id)
- sha.update(str(mlist.posting_address))
- message_id_hash = urlsafe_b64encode(sha.digest())
- del msg['x-message-id-hash']
- msg['X-Message-ID-Hash'] = message_id_hash
return urljoin(config.archiver.mail_archive.base_url, message_id_hash)
@staticmethod