forked from MarseyWorld/MarseyWorld
disable empty searches
parent
5902fa5822
commit
afc5c82fef
|
@ -46,8 +46,9 @@ def searchparse(text):
|
||||||
@limiter.limit(DEFAULT_RATELIMIT, key_func=get_ID)
|
@limiter.limit(DEFAULT_RATELIMIT, key_func=get_ID)
|
||||||
@auth_required
|
@auth_required
|
||||||
def searchposts(v:User):
|
def searchposts(v:User):
|
||||||
|
|
||||||
query = request.values.get("q", '').strip()
|
query = request.values.get("q", '').strip()
|
||||||
|
if not query:
|
||||||
|
abort(403, "Empty searches aren't allowed!")
|
||||||
|
|
||||||
try: page = max(1, int(request.values.get("page", 1)))
|
try: page = max(1, int(request.values.get("page", 1)))
|
||||||
except: abort(400, "Invalid page input!")
|
except: abort(400, "Invalid page input!")
|
||||||
|
@ -174,6 +175,8 @@ def searchposts(v:User):
|
||||||
@auth_required
|
@auth_required
|
||||||
def searchcomments(v:User):
|
def searchcomments(v:User):
|
||||||
query = request.values.get("q", '').strip()
|
query = request.values.get("q", '').strip()
|
||||||
|
if not query:
|
||||||
|
abort(403, "Empty searches aren't allowed!")
|
||||||
|
|
||||||
try: page = max(1, int(request.values.get("page", 1)))
|
try: page = max(1, int(request.values.get("page", 1)))
|
||||||
except: abort(400, "Invalid page input!")
|
except: abort(400, "Invalid page input!")
|
||||||
|
|
Loading…
Reference in New Issue