From baca55c94e002abbdeb428b31ab92f558195adda Mon Sep 17 00:00:00 2001 From: Adam Tauber Date: Mon, 16 Mar 2020 00:22:15 +0100 Subject: [PATCH 1/2] [fix] handle weights in accept language parsing - fixes w3ms en;q=1.0 --- searx/webapp.py | 3 +++ 1 file changed, 3 insertions(+) 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 From 822aee94a2e50923252faf7ae11b4b03017c1a1a Mon Sep 17 00:00:00 2001 From: Adam Tauber Date: Mon, 16 Mar 2020 00:22:38 +0100 Subject: [PATCH 2/2] [fix] remove debug print --- searx/webapp.py | 1 - 1 file changed, 1 deletion(-) diff --git a/searx/webapp.py b/searx/webapp.py index cfb552514..b3928921e 100644 --- a/searx/webapp.py +++ b/searx/webapp.py @@ -650,7 +650,6 @@ def index(): response.headers.add('Content-Disposition', cont_disp) return response elif output_format == 'rss': - print(results) response_rss = render( 'opensearch_response_rss.xml', results=results,