Skip to content

SearXNG is a free internet metasearch engine which aggregates results from various search services and databases. Users are neither tracked nor profiled.

Drop Python 2 (5/n): searx.utils.is_valid_lang, input parameter is a str instead of bytes

Alexandre Flamentbdac99d4f034
diff --git a/searx/utils.py b/searx/utils.py
index de5b68ca3..d8842c65f 100644
--- a/searx/utils.py
+++ b/searx/utils.py
@@ -284,8 +284,10 @@ def int_or_zero(num):
def is_valid_lang(lang):
+ if isinstance(lang, bytes):
+ lang = lang.decode()
is_abbr = (len(lang) == 2)
- lang = lang.lower().decode()
+ lang = lang.lower()
if is_abbr:
for l in language_codes:
if l[0][:2] == lang: