diff options
Diffstat (limited to 'src/mailman/archiving/mhonarc.py')
| -rw-r--r-- | src/mailman/archiving/mhonarc.py | 20 |
1 files changed, 5 insertions, 15 deletions
diff --git a/src/mailman/archiving/mhonarc.py b/src/mailman/archiving/mhonarc.py index db0b12c3d..0beeed73e 100644 --- a/src/mailman/archiving/mhonarc.py +++ b/src/mailman/archiving/mhonarc.py @@ -25,11 +25,9 @@ __all__ = [ ] -import hashlib import logging import subprocess -from base64 import b32encode from urlparse import urljoin from zope.interface import implements @@ -63,20 +61,12 @@ class MHonArc: def permalink(mlist, msg): """See `IArchiver`.""" # XXX What about private MHonArc archives? - 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) - message_id_hash = b32encode(sha.digest()) - del msg['x-message-id-hash'] - msg['X-Message-ID-Hash'] = message_id_hash return urljoin(MHonArc.list_url(mlist), message_id_hash) @staticmethod |
