This is an automated email from the ASF dual-hosted git repository.
humbedooh pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-ponymail-foal.git
The following commit(s) were added to refs/heads/master by this push:
new f29231a If pipermail, reconstruct From: headers if need be.
f29231a is described below
commit f29231a85091fb25aa6a40ab0c17262562dbfa44
Author: Daniel Gruno <[email protected]>
AuthorDate: Wed Feb 17 15:04:43 2021 +0100
If pipermail, reconstruct From: headers if need be.
Pipermail has a tendency to change "foo <bar@baz>" into "bar at baz (foo)",
and we don't wan that. So we change it back on import.
---
tools/import-mbox.py | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/tools/import-mbox.py b/tools/import-mbox.py
index dee1e18..dad80d8 100755
--- a/tools/import-mbox.py
+++ b/tools/import-mbox.py
@@ -253,6 +253,14 @@ class SlurpThread(Thread):
self.printid("No list id found for %s " %
message["message-id"])
bad += 1
continue
+
+ # If fetched from Pipermail, we have to revert/reconstruct
From: headers sometimes,
+ # before we can pass it off to final archiving.
+ if args.pipermail and " at " in message.get("from"):
+ m = re.match(r"^(\S+) at (\S+) \((.+)\)$", message["from"])
+ if m:
+ message.replace_header("from", "%s <%s@%s>" %
(m.group(3), m.group(1), m.group(2)))
+
json, contents, _msgdata, _irt = archie.compute_updates(
list_override, private, message, message_raw