summaryrefslogtreecommitdiff
path: root/searx/webapp.py
diff options
context:
space:
mode:
authorAlexandre Flament <alex@al-f.net>2020-11-06 12:11:52 +0100
committerAlexandre Flament <alex@al-f.net>2020-11-06 12:11:52 +0100
commitb3a3ccf2dbf93b26c506904f53d03e5f11398aab (patch)
tree08d8bb6bbd2633bb7ad9788ba2d0c69dd56ad917 /searx/webapp.py
parentc03e4c86bc49d6ef4664c038066d9f1c16e7dafc (diff)
downloadsearxng-b3a3ccf2dbf93b26c506904f53d03e5f11398aab.tar.gz
searxng-b3a3ccf2dbf93b26c506904f53d03e5f11398aab.zip
[fix] fix of / and /search
* URL / : the index page displayed the selected or the default category. * URL / : when the q parameter is set using the URL, the redirect includes the URL query. * URL /search : an empty query doesn't raise an exception.
Diffstat (limited to 'searx/webapp.py')
-rwxr-xr-xsearx/webapp.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/searx/webapp.py b/searx/webapp.py
index 46d547d52..035e039f0 100755
--- a/searx/webapp.py
+++ b/searx/webapp.py
@@ -537,10 +537,12 @@ def index():
# redirect to search if there's a query in the request
if request.form.get('q'):
- return redirect(url_for('search'), 308)
+ query = ('?' + request.query_string.decode()) if request.query_string else ''
+ return redirect(url_for('search') + query, 308)
return render(
'index.html',
+ selected_categories=get_selected_categories(request.preferences, request.form),
)
@@ -556,8 +558,8 @@ def search():
if output_format not in ['html', 'csv', 'json', 'rss']:
output_format = 'html'
- # check if there is query
- if request.form.get('q') is None:
+ # check if there is query (not None and not an empty string)
+ if not request.form.get('q'):
if output_format == 'html':
return render(
'index.html',