From e990cf4a62bf20a944ed7f1d2f0bb70d36a08f17 Mon Sep 17 00:00:00 2001 From: Aevann Date: Tue, 9 May 2023 21:39:56 +0300 Subject: [PATCH] fix 500 error --- files/routes/search.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/files/routes/search.py b/files/routes/search.py index 0a22b4d2a..7c8481409 100644 --- a/files/routes/search.py +++ b/files/routes/search.py @@ -338,9 +338,11 @@ def searchmessages(v:User): if 'sentto' in criteria: sentto = criteria['sentto'] - try: sentto = get_user(sentto, graceful=True) - except: + sentto = get_user(sentto, graceful=True) + + if not sentto: abort(400, "The `sentto` field must contain a user's username!") + comments = comments.filter(Comment.sentto == sentto.id) total = comments.count()