diff options
author | Alexandre FLAMENT <alexandre.flament@hesge.ch> | 2022-08-26 20:34:25 +0000 |
---|---|---|
committer | Alexandre FLAMENT <alexandre.flament@hesge.ch> | 2022-08-27 07:10:26 +0000 |
commit | 2af1a6f5473a804dfa3258cc6384ec4c58c89b74 (patch) | |
tree | 942e0d09b4cc674de1332be5b4bfbf536ab46f1f /searx/external_bang.py | |
parent | 5284de9137c43c2a343958c5c3fccf97b72d65a3 (diff) | |
download | searxng-2af1a6f5473a804dfa3258cc6384ec4c58c89b74.tar.gz searxng-2af1a6f5473a804dfa3258cc6384ec4c58c89b74.zip |
External bang: bug fix: URL encode the query so "!!g 1+1" works as intended
Diffstat (limited to 'searx/external_bang.py')
-rw-r--r-- | searx/external_bang.py | 3 |
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 |