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()