Encode slashes in search terms for searchengines

If a search term contains a slash, this should be encoded. While this
makes no differences for search engines of the form

    http://example.org?q={}

it does for engines like these:

    http://example.org/search/{}

For a real world example, try:

    https://www.doi2bib.org/bib/{}
This commit is contained in:
Thorsten Wißmann 2018-11-21 17:27:32 +01:00 committed by Florian Bruhin
parent e07e70361e
commit 31a122e97b

View File

@ -116,7 +116,7 @@ def _get_search_url(txt):
if engine is None:
engine = 'DEFAULT'
template = config.val.url.searchengines[engine]
url = qurl_from_user_input(template.format(urllib.parse.quote(term)))
url = qurl_from_user_input(template.format(urllib.parse.quote(term, safe='')))
if config.val.url.open_base_url and term in config.val.url.searchengines:
url = qurl_from_user_input(config.val.url.searchengines[term])