From 16abd740316ed61b8788fd45cae0e303221fb33b Mon Sep 17 00:00:00 2001 From: Aevann Date: Sat, 20 Jan 2024 09:02:08 +0200 Subject: [PATCH] actually return an error instead --- files/routes/hats.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/files/routes/hats.py b/files/routes/hats.py index 499fb729d..e20fbd79c 100644 --- a/files/routes/hats.py +++ b/files/routes/hats.py @@ -26,7 +26,9 @@ def hats(v): hats = hats.filter(HatDef.submitter_id == None) if sort and sort != "owners": - if sort == "description": + if sort == "name": + key = HatDef.name + elif sort == "description": key = HatDef.description elif sort == "author": key = User.username @@ -35,7 +37,7 @@ def hats(v): elif sort == "added_on": key = HatDef.created_utc.desc() else: - key = HatDef.name + abort(400, "Invalid sort") hats = hats.order_by(key).offset(PAGE_SIZE * (page - 1)).limit(PAGE_SIZE).all() elif sort == "owners":