Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion pygeoapi/api/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1322,7 +1322,8 @@ def evaluate_limit(requested: Union[None, int], server_limits: dict,
else:
requested2 = get_typed_value(requested)

if not isinstance(requested2, int):
# bool is a subclass of int, but limit=true is not a valid limit
if isinstance(requested2, bool) or not isinstance(requested2, int):
raise ValueError('limit value should be an integer')

if requested2 <= 0:
Expand Down
4 changes: 4 additions & 0 deletions tests/api/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -996,6 +996,10 @@ def test_evaluate_limit():
with pytest.raises(ValueError):
assert evaluate_limit('-12', server, collection) == 10

for value in ['true', 'false', True]:
with pytest.raises(ValueError, match='should be an integer'):
evaluate_limit(value, server, collection)

assert evaluate_limit('1', server, collection) == 1

collection = {}
Expand Down
Loading