summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarkus Heiser <markus.heiser@darmarIT.de>2022-08-28 09:07:24 +0200
committerGitHub <noreply@github.com>2022-08-28 09:07:24 +0200
commit3be847149ea35b015670da538cc4507fd564bd15 (patch)
treea054e858ceed06a3531cf7c3d6953e4aeb5969d8
parent56000d51622f924bd0f5cba2008dccd548b9041e (diff)
parent2af1a6f5473a804dfa3258cc6384ec4c58c89b74 (diff)
downloadsearxng-3be847149ea35b015670da538cc4507fd564bd15.tar.gz
searxng-3be847149ea35b015670da538cc4507fd564bd15.zip
Merge pull request #1707 from dalf/fix-external-bang
External bang: bug fix: URL encode the query so "!!g 1+1" works as intended
-rw-r--r--searx/external_bang.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/searx/external_bang.py b/searx/external_bang.py
index a56737c73..20de9c77f 100644
--- a/searx/external_bang.py
+++ b/searx/external_bang.py
@@ -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