You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ponymail.apache.org by hu...@apache.org on 2021/06/06 10:27:18 UTC
[incubator-ponymail-foal] branch master updated: Be strict about
requiring both list and domain keywords, assert no mixups
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 16e3da1 Be strict about requiring both list and domain keywords, assert no mixups
16e3da1 is described below
commit 16e3da13e7743aa6c1a62e2068bdde29a9cb0691
Author: Daniel Gruno <hu...@apache.org>
AuthorDate: Sun Jun 6 12:27:09 2021 +0200
Be strict about requiring both list and domain keywords, assert no mixups
This addresses and fixes #40
---
server/plugins/defuzzer.py | 13 +++++--------
1 file changed, 5 insertions(+), 8 deletions(-)
diff --git a/server/plugins/defuzzer.py b/server/plugins/defuzzer.py
index 9c22edc..a616ca3 100644
--- a/server/plugins/defuzzer.py
+++ b/server/plugins/defuzzer.py
@@ -80,14 +80,11 @@ def defuzz(formdata: dict, nodate: bool = False) -> dict:
}
# List parameter(s)
- if "domain" in formdata:
- fqdn = formdata["domain"]
- listname = formdata.get("list", "*")
- elif "list" in formdata:
- listname, fqdn = formdata["list"].split("@", 1)
- else: # No domain or list at all? BORK!
- listname = "*"
- fqdn = "*"
+ fqdn = formdata.get("domain", "*") # If left out entirely, assume wildcard search
+ listname = formdata.get("list", "*") # If left out entirely, assume wildcard search
+ assert fqdn, "You must specify a domain part of the mailing list(s) to search, or * for wildcard search."
+ assert listname, "You must specify a list part of the mailing list(s) to search, or * for wildcard search."
+ assert '@' not in listname, "The list component of the List ID(s) cannot contain @, please use both list and domain keywords for searching."
list_raw = "<%s.%s>" % (listname, fqdn)
# Default is to look in a specific list