1
0
mirror of https://github.com/ilri/dspace-statistics-api.git synced 2024-11-26 08:08:19 +01:00

Make sure limit is between 1 and 100

We were not properly checking whether the limit was actually less
than or equal to 100.
This commit is contained in:
Alan Orth 2020-11-18 21:55:54 +02:00
parent 3995eba0a7
commit 88a8db6c78
Signed by: alanorth
GPG Key ID: 0FB860CC9C45B1B9

View File

@ -103,7 +103,7 @@ def validate_items_post_parameters(req, resp, resource, params):
# Parse the limit parameter from the POST request body # Parse the limit parameter from the POST request body
if "limit" in doc: if "limit" in doc:
if isinstance(doc["limit"], int) and 0 < doc["limit"] < 100: if isinstance(doc["limit"], int) and 0 < doc["limit"] <= 100:
req.context.limit = doc["limit"] req.context.limit = doc["limit"]
else: else:
raise falcon.HTTPBadRequest( raise falcon.HTTPBadRequest(