This is an automated email from the ASF dual-hosted git repository.
sebb 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 8c4bcd4 Unused md5 hash
8c4bcd4 is described below
commit 8c4bcd4fbf472fe23a1efaaf43c8d6f52707ed86
Author: Sebb <[email protected]>
AuthorDate: Mon Nov 15 17:21:23 2021 +0000
Unused md5 hash
This fixes #126
Note that extract_name is no longer needed.
In any case, its code does not work for all possible from headers.
---
server/plugins/messages.py | 13 -------------
1 file changed, 13 deletions(-)
diff --git a/server/plugins/messages.py b/server/plugins/messages.py
index 6be6a63..5073f7d 100644
--- a/server/plugins/messages.py
+++ b/server/plugins/messages.py
@@ -82,15 +82,6 @@ def trim_email(doc, external=False):
del doc[header]
-def extract_name(addr):
- """ Extract name and email from from: header """
- m = re.match(r"^([^<]+)\s*<(.+)>$", addr)
- if m:
- return [m.group(1), m.group(2)]
- addr = addr.strip("<>")
- return [addr, addr]
-
-
# Format an email address given a name (optional) and an email address.
# Same as email.utils.formataddr except no Unicode escaping happens.
def make_address(name, email):
@@ -128,10 +119,6 @@ def anonymize(doc):
ptr = doc["_source"]
if "from" in ptr:
- _frname, fremail = extract_name(ptr["from"])
- ptr["md5"] = hashlib.md5(
- bytes(fremail.lower(), encoding="ascii", errors="replace")
- ).hexdigest()
ptr["from"] = anonymize_mail_address(ptr["from"])
if "to" in ptr:
ptr["to"] = anonymize_mail_address(ptr["to"])