Skip to content

Commit 0bda3a8

Browse files
committed
fix 'multiples' detection so it recognizes date ranges as well
1 parent 581c4d3 commit 0bda3a8

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/server/_limiter.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
from ._exceptions import ValidationFailedException
1010
from ._params import extract_dates, extract_integers, extract_strings
1111
from ._security import _is_public_route, current_user, require_api_key, show_no_api_key_warning, resolve_auth_token, ERROR_MSG_RATE_LIMIT, ERROR_MSG_MULTIPLES
12+
from .utils import TimeValues
1213

1314

1415
def deduct_on_success(response: Response) -> bool:
@@ -58,6 +59,9 @@ def get_multiples_count(request):
5859
vals = multiples.get(k)(k)
5960
if len(vals) >= 2:
6061
multiple_selection_allowed -= 1
62+
elif len(vals) and isinstance(vals, TimeValues) and isinstance(vals[0], tuple):
63+
# else we have one TimeValue which is a tuple, representing a range, and thus is a "multiple"
64+
multiple_selection_allowed -= 1
6165
except ValidationFailedException:
6266
continue
6367
except TypeError:

0 commit comments

Comments
 (0)