Skip to content

Commit

Permalink
Updated search view to trim leading and trailing whitespace for autho…
Browse files Browse the repository at this point in the history
…r, book, and list query values
  • Loading branch information
timothyjrogers committed Aug 11, 2024
1 parent 95c2798 commit 2bb77d9
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions bookwyrm/views/search.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def get(self, request):

def api_book_search(request):
"""Return books via API response"""
query = request.GET.get("q")
query = request.GET.get("q").strip()
query = isbn_check_and_format(query)
min_confidence = request.GET.get("min_confidence", 0)
# only return local book results via json so we don't cascade
Expand All @@ -65,7 +65,7 @@ def api_book_search(request):

def book_search(request):
"""the real business is elsewhere"""
query = request.GET.get("q")
query = request.GET.get("q").strip()
# check if query is isbn
query = isbn_check_and_format(query)
min_confidence = request.GET.get("min_confidence", 0)
Expand Down Expand Up @@ -123,8 +123,7 @@ def author_search(request):
def user_search(request):
"""user search: search for a user"""
viewer = request.user
query = request.GET.get("q")
query = query.strip()
query = request.GET.get("q").strip()
data = {"type": "user", "query": query}

# use webfinger for mastodon style account@domain.com username to load the user if
Expand Down Expand Up @@ -162,7 +161,7 @@ def user_search(request):

def list_search(request):
"""any relevent lists?"""
query = request.GET.get("q")
query = request.GET.get("q").strip()
data = {"query": query, "type": "list"}
results = (
models.List.privacy_filter(
Expand Down

0 comments on commit 2bb77d9

Please sign in to comment.