diff options
author | Markus Heiser <markus.heiser@darmarit.de> | 2023-10-29 11:20:41 +0100 |
---|---|---|
committer | Markus Heiser <markus.heiser@darmarIT.de> | 2023-10-29 16:17:25 +0100 |
commit | 7e2e335dd1e06ea20496028abe58b3ad8b255662 (patch) | |
tree | 9a6fe6165b54239641f378cace08e1bf4434b212 /searx/webadapter.py | |
parent | 9aeae2142bfca4cdbf49d295ade4fcebec5693a5 (diff) | |
download | searxng-7e2e335dd1e06ea20496028abe58b3ad8b255662.tar.gz searxng-7e2e335dd1e06ea20496028abe58b3ad8b255662.zip |
[fix] limit maximum page number of a search query to page 50.
To test this PR run a local instance and try to query page 51:
http://127.0.0.1:8888/search?q=foo&pageno=51
A parameter exception will be raised:
searx.exceptions.SearxParameterException: Invalid value "51" for parameter pageno
And the client will receive a HTTP 400 (Bad request).
Closes https://github.com/searxng/searxng/issues/2972
Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
Diffstat (limited to 'searx/webadapter.py')
-rw-r--r-- | searx/webadapter.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/searx/webadapter.py b/searx/webadapter.py index 9fbb8ea3e..967ed4429 100644 --- a/searx/webadapter.py +++ b/searx/webadapter.py @@ -45,7 +45,7 @@ def validate_engineref_list( def parse_pageno(form: Dict[str, str]) -> int: pageno_param = form.get('pageno', '1') - if not pageno_param.isdigit() or int(pageno_param) < 1: + if not pageno_param.isdigit() or int(pageno_param) < 1 or int(pageno_param) > 50: raise SearxParameterException('pageno', pageno_param) return int(pageno_param) |