зеркало из https://github.com/mozilla/bedrock.git
Revert "Fix #11890: Append slash at locale root URL"
This reverts commit 89ed50238a
.
This commit is contained in:
Родитель
d4920b3fa7
Коммит
bcd61a8a61
|
@ -166,10 +166,7 @@ def render(request, template, context=None, ftl_files=None, activation_files=Non
|
|||
|
||||
# Does that path's locale match the request's locale?
|
||||
if locale in translations:
|
||||
# Redirect to the locale if:
|
||||
# - The URL is the root path but is missing the trailing slash OR
|
||||
# - The locale isn't in current prefix in the URL.
|
||||
if request.path == f"/{locale}" or locale != request.path.lstrip("/").partition("/")[0]:
|
||||
if locale != request.path.lstrip("/").partition("/")[0]:
|
||||
return redirect_to_locale(request, locale)
|
||||
else:
|
||||
return redirect_to_best_locale(request, translations)
|
||||
|
|
|
@ -62,8 +62,6 @@ class TestRender(TestCase):
|
|||
self._test("/firefox/new/", template, "", "", 404, active_locales=locales)
|
||||
|
||||
# Test that a locale+path and no accept language header returns 200 as long as the locales are supported.
|
||||
self._test("/en-US", template, "", "", 302, "/en-US/", active_locales=locales)
|
||||
self._test("/en-US/", template, "", "", 200, active_locales=locales)
|
||||
self._test("/en-US/firefox/new/", template, "", "", 200, active_locales=locales)
|
||||
self._test("/en-GB/firefox/new/", template, "", "", 200, active_locales=locales)
|
||||
self._test("/fr/firefox/new/", template, "", "", 200, active_locales=locales)
|
||||
|
|
Загрузка…
Ссылка в новой задаче