From eecfff268913045f957c0fceb2a1caf56f236a1f Mon Sep 17 00:00:00 2001 From: Alexandre Flament Date: Tue, 22 Sep 2020 16:31:17 +0200 Subject: [PATCH] [mod] check time_range parameter in searx/webadapter.py --- searx/search.py | 2 +- searx/webadapter.py | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/searx/search.py b/searx/search.py index b81112c9d..3619287b9 100644 --- a/searx/search.py +++ b/searx/search.py @@ -69,7 +69,7 @@ class SearchQuery: self.lang = lang self.safesearch = safesearch self.pageno = pageno - self.time_range = None if time_range in ('', 'None', None) else time_range + self.time_range = time_range self.timeout_limit = timeout_limit self.preferences = preferences self.external_bang = external_bang diff --git a/searx/webadapter.py b/searx/webadapter.py index 97379b17e..0567c8d34 100644 --- a/searx/webadapter.py +++ b/searx/webadapter.py @@ -64,7 +64,8 @@ def get_search_query_from_webapp(preferences, form): query_time_range = form.get('time_range') # check time_range - if query_time_range not in ('None', None, '', 'day', 'week', 'month', 'year'): + query_time_range = None if query_time_range in ('', 'None') else query_time_range + if query_time_range not in (None, 'day', 'week', 'month', 'year'): raise SearxParameterException('time_range', query_time_range) # query_engines