From 7dffd6e0aa639830eea80e34abd0e69af2c88d66 Mon Sep 17 00:00:00 2001 From: lza_menace Date: Sun, 25 Apr 2021 13:17:28 -0700 Subject: [PATCH] fix query str args for list api --- suchwow/routes/api.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/suchwow/routes/api.py b/suchwow/routes/api.py index ff0f571..2135e3a 100644 --- a/suchwow/routes/api.py +++ b/suchwow/routes/api.py @@ -9,8 +9,14 @@ bp = Blueprint("api", "api") def api_list(): limit = request.args.get('limit', 30) offset = request.args.get('offset', 0) - if not isinstance(limit, int) or not isinstance(offset, int): + + # Hacky way to convert query str value to int + try: + limit = int(limit) + offset = int(offset) + except: abort(500, "Bleep bleep") + if limit > 30: limit = 30