diff options
author | Markus Heiser <markus.heiser@darmarIT.de> | 2023-05-22 12:46:26 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-05-22 12:46:26 +0200 |
commit | cea277ce5261cef6d4737f95e9d17bd07a28532b (patch) | |
tree | d9a1274972b0ea6d46d6df4b3da61db6b3cc646a | |
parent | 73c023bbea51c76516ea51321711d0f1d5299b7b (diff) | |
parent | bc647fabafa4d1ceafcfefc1bfebbfb7d2c13008 (diff) | |
download | searxng-cea277ce5261cef6d4737f95e9d17bd07a28532b.tar.gz searxng-cea277ce5261cef6d4737f95e9d17bd07a28532b.zip |
Merge pull request #2452 from return42/fix-2434
[fix] ClientPref - don't raise exception if Accept-Language is invalid
-rw-r--r-- | searx/preferences.py | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/searx/preferences.py b/searx/preferences.py index 8552305a7..aba712652 100644 --- a/searx/preferences.py +++ b/searx/preferences.py @@ -331,8 +331,12 @@ class ClientPref: except (ValueError, babel.core.UnknownLocaleError): continue pairs.append((locale, qvalue)) - pairs.sort(reverse=True, key=lambda x: x[1]) - return cls(locale=pairs[0][0]) + + locale = None + if pairs: + pairs.sort(reverse=True, key=lambda x: x[1]) + locale = pairs[0][0] + return cls(locale=locale) class Preferences: |