From 84ff6e289ea608207755b01bc648575a87ea55ba Mon Sep 17 00:00:00 2001 From: potato Date: Tue, 6 Sep 2016 12:46:18 +0200 Subject: [PATCH] [enh] filter non-existing language code/name containing requests --- searx/engines/dictionary.py | 5 +++++ 1 file changed, 5 insertions(+) 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