Wrap long condition in language redirect middleware

This commit is contained in:
2026-05-11 23:56:45 +02:00
parent 8a0c2849c0
commit b8e5272e26

View File

@@ -80,7 +80,10 @@ class FirstVisitLanguageRedirectMiddleware:
matched = get_language_from_request(request, check_path=False)
if matched:
normalized = matched.split("-")[0].lower()
if normalized in self.supported_languages and normalized != self.default_language:
if (
normalized in self.supported_languages
and normalized != self.default_language
):
return normalized
# Fallback to raw Accept-Language parsing for unprefixed default routes.