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/10/28 20:19:18 UTC

[incubator-ponymail-foal] branch master updated: if uneven number of quotes, split on whitespace only

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 9817073  if uneven number of quotes, split on whitespace only
9817073 is described below

commit 98170736d1004ec720a2812e1198beb5257e0a1d
Author: Daniel Gruno <hu...@apache.org>
AuthorDate: Thu Oct 28 22:18:31 2021 +0200

    if uneven number of quotes, split on whitespace only
---
 server/plugins/defuzzer.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/server/plugins/defuzzer.py b/server/plugins/defuzzer.py
index f5aa811..62ffb97 100644
--- a/server/plugins/defuzzer.py
+++ b/server/plugins/defuzzer.py
@@ -123,7 +123,10 @@ def defuzz(formdata: dict, nodate: bool = False, list_override: typing.Optional[
     # - "this sentence": find emails with this exact string
     if "q" in formdata:
         qs = formdata["q"].replace(":", "")
-        bits = shlex.split(qs)
+        try:
+            bits = shlex.split(qs)
+        except ValueError:  # Uneven number of quotes, default to split on whitespace instead
+            bits = qs.split()
 
         query_should_match = []
         query_should_not_match = []