You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ponymail.apache.org by se...@apache.org on 2021/10/10 23:18:31 UTC

[incubator-ponymail-foal] branch master updated: listname and domain should not default to '*'

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 cab334d  listname and domain should not default to '*'
cab334d is described below

commit cab334dc9c45f60ee52e247fdf0ee55128cd6c81
Author: Sebb <se...@apache.org>
AuthorDate: Mon Oct 11 00:18:12 2021 +0100

    listname and domain should not default to '*'
    
    Partial fix for #111
---
 server/endpoints/stats.py | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/server/endpoints/stats.py b/server/endpoints/stats.py
index f46830c..c0d0371 100644
--- a/server/endpoints/stats.py
+++ b/server/endpoints/stats.py
@@ -35,6 +35,12 @@ async def process(
     server: plugins.server.BaseServer, session: plugins.session.SessionObject, indata: dict,
 ) -> typing.Union[dict, aiohttp.web.Response]:
 
+    # must provide list and domain
+    xlist = indata.get("list", None)
+    xdomain = indata.get("domain", None)
+    if not xlist or not xdomain:
+        return aiohttp.web.Response(headers={"content-type": "application/json",}, text='{}')
+
     try:
         query_defuzzed = plugins.defuzzer.defuzz(indata)
         query_defuzzed_nodate = plugins.defuzzer.defuzz(indata, nodate=True)
@@ -44,8 +50,6 @@ async def process(
         session, query_defuzzed, query_limit=server.config.database.max_hits, shorten=True,
     )
 
-    xlist = indata.get("list", "*")
-    xdomain = indata.get("domain", "*")
     # statsOnly: Whether to only send statistical info (for n-grams etc), and not the
     # thread struct and message bodies
     # Param: quick