mirror of
https://github.com/searxng/searxng.git
synced 2024-11-19 19:00:10 +01:00
Merge pull request #1707 from dalf/fix-external-bang
External bang: bug fix: URL encode the query so "!!g 1+1" works as intended
This commit is contained in:
commit
3be847149e
@ -1,5 +1,6 @@
|
||||
# SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
from urllib.parse import quote_plus
|
||||
from searx.data import EXTERNAL_BANGS
|
||||
|
||||
LEAF_KEY = chr(16)
|
||||
@ -39,7 +40,7 @@ def get_bang_definition_and_ac(external_bangs_db, bang):
|
||||
|
||||
def resolve_bang_definition(bang_definition, query):
|
||||
url, rank = bang_definition.split(chr(1))
|
||||
url = url.replace(chr(2), query)
|
||||
url = url.replace(chr(2), quote_plus(query))
|
||||
if url.startswith('//'):
|
||||
url = 'https:' + url
|
||||
rank = int(rank) if len(rank) > 0 else 0
|
||||
|
Loading…
Reference in New Issue
Block a user