diff options
author | potato <mail@crazypotato.tk> | 2016-09-06 12:46:18 +0200 |
---|---|---|
committer | potato <mail@crazypotato.tk> | 2016-09-06 12:46:18 +0200 |
commit | 84ff6e289ea608207755b01bc648575a87ea55ba (patch) | |
tree | b05a918cee3f450d6fd1b0c3c3a9eb377c2b57e5 /searx/engines | |
parent | b808a2e26670e06d6f912f7d169a9c59ee7ac8ee (diff) | |
download | searxng-84ff6e289ea608207755b01bc648575a87ea55ba.tar.gz searxng-84ff6e289ea608207755b01bc648575a87ea55ba.zip |
[enh] filter non-existing language code/name containing requests
Diffstat (limited to 'searx/engines')
-rw-r--r-- | searx/engines/dictionary.py | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/searx/engines/dictionary.py b/searx/engines/dictionary.py index 080f7b4a4..b255463aa 100644 --- a/searx/engines/dictionary.py +++ b/searx/engines/dictionary.py @@ -25,6 +25,9 @@ def request(query, params): from_lang = lan[0][1].lower() else: return params + elif from_lang.lower() not in [x[1].lower() for x in language_codes]: + return params + if len(to_lang) == 2: lan = filter(lambda x: x[0][:2] == to_lang, language_codes) @@ -32,6 +35,8 @@ def request(query, params): to_lang = lan[0][1].lower() else: return params + elif to_lang.lower() not in [x[1].lower() for x in language_codes]: + return params params['url'] = url.format(from_lang=from_lang, to_lang=to_lang,query=query) params['from_lang'] = from_lang |