forked from mirrors/bookwyrm
Avoids error on empty search query
This commit is contained in:
parent
daf2fd1667
commit
66b7a3d193
2 changed files with 4 additions and 2 deletions
|
@ -15,6 +15,8 @@ class ConnectorException(HTTPError):
|
|||
|
||||
def search(query, min_confidence=0.1):
|
||||
""" find books based on arbitary keywords """
|
||||
if not query:
|
||||
return []
|
||||
results = []
|
||||
|
||||
# Have we got a ISBN ?
|
||||
|
|
|
@ -31,7 +31,7 @@ class Search(View):
|
|||
return JsonResponse([r.json() for r in book_results], safe=False)
|
||||
|
||||
# use webfinger for mastodon style account@domain.com username
|
||||
if re.match(regex.full_username, query):
|
||||
if query and re.match(regex.full_username, query):
|
||||
handle_remote_webfinger(query)
|
||||
|
||||
# do a user search
|
||||
|
@ -73,6 +73,6 @@ class Search(View):
|
|||
"book_results": book_results,
|
||||
"user_results": user_results,
|
||||
"list_results": list_results,
|
||||
"query": query,
|
||||
"query": query or "",
|
||||
}
|
||||
return TemplateResponse(request, "search_results.html", data)
|
||||
|
|
Loading…
Reference in a new issue