Merge pull request #837 from mouse-reeve/search-webfinger

Search fixes
This commit is contained in:
Mouse Reeve 2021-03-31 12:34:46 -07:00 committed by GitHub
commit fba9e0fdb6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 2 deletions

View file

@ -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 ?

View file

@ -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(r"\B%s" % 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)