From 7934fc92736d0e4c0303fb990a50df5d1c32550f Mon Sep 17 00:00:00 2001 From: renaud gaudin Date: Fri, 8 Sep 2023 11:14:08 +0000 Subject: [PATCH] Account for manual limits being str --- api/src/routes/requests.py | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/api/src/routes/requests.py b/api/src/routes/requests.py index dbca2c4..704f651 100644 --- a/api/src/routes/requests.py +++ b/api/src/routes/requests.py @@ -70,16 +70,16 @@ def post(self, *args, **kwargs): del document["flags"][flag] # make sure we cap requests to ZIMIT_LIMIT at most - document["flags"]["sizeLimit"] = str( - min( - [document["flags"].get("sizeLimit", ZIMIT_SIZE_LIMIT), ZIMIT_SIZE_LIMIT] - ) - ) - document["flags"]["timeLimit"] = str( - min( - [document["flags"].get("timeLimit", ZIMIT_TIME_LIMIT), ZIMIT_TIME_LIMIT] - ) - ) + try: + size_limit = int(document["flags"].get("sizeLimit", ZIMIT_SIZE_LIMIT)) + except Exception: + size_limit = ZIMIT_SIZE_LIMIT + document["flags"]["sizeLimit"] = str(min([size_limit, ZIMIT_SIZE_LIMIT])) + try: + time_limit = int(document["flags"].get("timeLimit", ZIMIT_TIME_LIMIT)) + except Exception: + time_limit = ZIMIT_TIME_LIMIT + document["flags"]["timeLimit"] = min([time_limit, ZIMIT_TIME_LIMIT]) config = { "task_name": "zimit",