-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Clean bogus in-reply-to headers before store it #65
Comments
BTW, the consequence of having a bogus Something that MLStats does not handle is multiple |
Another example, the
|
Something like this should work: diff --git a/pymlstats/analyzer.py b/pymlstats/analyzer.py
index 8c0fa63..7f98bdd 100644
--- a/pymlstats/analyzer.py
+++ b/pymlstats/analyzer.py
@@ -87,8 +87,7 @@ class MailArchiveAnalyzer:
'in-reply-to',
'subject',
'body']
- common_headers = ['message-id', 'in-reply-to', 'list-id',
- 'content-type', 'references']
+ common_headers = ['message-id', 'list-id', 'content-type', 'references']
def __init__(self, archive=None):
self.archive = archive
@@ -155,6 +154,9 @@ class MailArchiveAnalyzer:
filtered_message['date'] = msgdate
filtered_message['date_tz'] = str(tz_secs)
+ in_reply_to = message.get('in-reply-to')
+ filtered_message['in-reply-to'] = re.sub(r'^.*[^<]*(<.*>).*', r'\1', in_reply_to)
+
# Retrieve other headers requested
for header in self.common_headers:
msg = message.get(header) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
There are some email clients that add noise to the header field
in-reply-to
. For example,http://lists.openstack.org/pipermail/openstack-dev/2012-August.txt.gz :
The actual
Message-id
is<[email protected]>
, without the garbage at the end (which is how it is inReferences
).The text was updated successfully, but these errors were encountered: