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 0c9004a List-ID normalized needs to adhere to what we can call a doc
0c9004a is described below
commit 0c9004a5105308f1511f8811732571fd7447100f
Author: Daniel Gruno <[email protected]>
AuthorDate: Mon Aug 24 13:18:34 2020 +0200
List-ID normalized needs to adhere to what we can call a doc
As Doc ID in most cases depend on the List-ID, we need to ensure it is
valid for doc IDs. Thus, only allow what we know is likely to be in a
list ID and is valid as a doc ID.
---
tools/archiver.py | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/tools/archiver.py b/tools/archiver.py
index c422108..d6e21d4 100755
--- a/tools/archiver.py
+++ b/tools/archiver.py
@@ -142,6 +142,11 @@ def normalize_lid(lid: str) -> str: # N.B. Also used by
import-mbox.py
lid = m.group(1)
# Belt-and-braces: remove possible extraneous chars
lid = "<%s>" % lid.strip(" <>").replace("@", ".")
+ # Replace invalid characters with underscores so as to not invalidate doc
IDs.
+ lid = re.sub(
+ r"[^-+~_<>.a-zA-Z0-9@]", "_", lid
+ )
+ # Finally, ensure we have a loosely valid list ID value
if not re.match(r"^<.+\..+>$", lid):
print("Invalid list-id %s" % lid)
sys.exit(-1)