Pass response as str to bsoup for "my ip" card

Due to how the response is now reformed into a new bsoup object when
bolding search query terms, creating an ip card for "my ip" searches
threw an error due to how the new bsoup object was initialized for the
"my ip" card. This passes the response in as a string instead.

Fixes #504
main
Ben Busby 2021-10-28 21:21:21 -06:00
parent cad1e2ab4d
commit 26b560da1d
No known key found for this signature in database
GPG Key ID: 339B7B7EB5333D14
1 changed files with 2 additions and 1 deletions

View File

@ -253,9 +253,10 @@ def search():
# Return 503 if temporarily blocked by captcha # Return 503 if temporarily blocked by captcha
resp_code = 503 if has_captcha(str(response)) else 200 resp_code = 503 if has_captcha(str(response)) else 200
response = bold_search_terms(response, query) response = bold_search_terms(response, query)
# Feature to display IP address # Feature to display IP address
if search_util.check_kw_ip(): if search_util.check_kw_ip():
html_soup = bsoup(response, "html.parser") html_soup = bsoup(str(response), 'html.parser')
response = add_ip_card(html_soup, request.remote_addr) response = add_ip_card(html_soup, request.remote_addr)
return render_template( return render_template(