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/07 07:17:09 UTC

[incubator-ponymail-foal] branch master updated: Pass on list ID as domain override if @ present init

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 b3b5de4  Pass on list ID as domain override if @ present init
b3b5de4 is described below

commit b3b5de432f4fc31f49abb518f69af19759399823
Author: Daniel Gruno <hu...@apache.org>
AuthorDate: Mon Jun 7 09:17:02 2021 +0200

    Pass on list ID as domain override if @ present init
---
 server/endpoints/mbox.py | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/server/endpoints/mbox.py b/server/endpoints/mbox.py
index 0a21668..082e78c 100644
--- a/server/endpoints/mbox.py
+++ b/server/endpoints/mbox.py
@@ -29,8 +29,11 @@ async def process(
     server: plugins.server.BaseServer, session: plugins.session.SessionObject, indata: dict,
 ) -> typing.Union[dict, aiohttp.web.Response]:
 
+    lid = indata.get("list", "_")
+    domain = indata.get("domain", "_")
+    
     try:
-        query_defuzzed = plugins.defuzzer.defuzz(indata)
+        query_defuzzed = plugins.defuzzer.defuzz(indata, list_override="@" in lid and lid)
     except AssertionError as e:  # If defuzzer encounters syntax errors, it will throw an AssertionError
         return aiohttp.web.Response(headers={"content-type": "text/plain",}, status=500, text=str(e))
     results = await plugins.messages.query(session, query_defuzzed, query_limit=server.config.database.max_hits,)
@@ -51,8 +54,8 @@ async def process(
             sources.append(mboxrd_source)
 
     # Figure out a sane filename
-    xlist = re.sub(r"[^-_.a-z0-9]+", "_", indata.get("list", "_"))
-    xdomain = re.sub(r"[^-_.a-z0-9]+", "_", indata.get("domain", "_"))
+    xlist = re.sub(r"[^-_.a-z0-9]+", "_", lid)
+    xdomain = re.sub(r"[^-_.a-z0-9]+", "_", domain)
     dlfile = f"{xlist}-{xdomain}.mbox"
 
     # Return mbox archive with filename