diff options
author | Adam Tauber <asciimoo@gmail.com> | 2020-03-16 00:22:15 +0100 |
---|---|---|
committer | Adam Tauber <asciimoo@gmail.com> | 2020-03-16 00:22:15 +0100 |
commit | baca55c94e002abbdeb428b31ab92f558195adda (patch) | |
tree | e89d039b5da8338649301fd95bdb9b3537cc4f63 | |
parent | 8e727ac77f5db59c1b772d9fd7603b519badb35a (diff) | |
download | searxng-baca55c94e002abbdeb428b31ab92f558195adda.tar.gz searxng-baca55c94e002abbdeb428b31ab92f558195adda.zip |
[fix] handle weights in accept language parsing - fixes w3ms en;q=1.0
-rw-r--r-- | searx/webapp.py | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/searx/webapp.py b/searx/webapp.py index 0c5ed4570..cfb552514 100644 --- a/searx/webapp.py +++ b/searx/webapp.py @@ -178,9 +178,12 @@ flask_babel.get_translations = _get_translations def _get_browser_language(request, lang_list): for lang in request.headers.get("Accept-Language", "en").split(","): + if ';' in lang: + lang = lang.split(';')[0] locale = match_language(lang, lang_list, fallback=None) if locale is not None: return locale + return settings['search']['default_lang'] or 'en' @babel.localeselector |