1
0
mirror of https://github.com/webrecorder/pywb.git synced 2025-03-15 00:03:28 +01:00

Fixes switch_locale not adding locale if missing from URL (#871)

If the two letter language code was missing in the URI, switch_locale(locale) didn't add it (it worked fine if it was present). That means that it produced the same URL for all locales, each missing the two letter language code in the URL.
This commit is contained in:
Ivan Jelenić 2023-11-23 16:50:56 +01:00 committed by GitHub
parent af92a9726e
commit 79140441df
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -178,7 +178,7 @@ class JinjaEnv(object):
request_uri = environ.get('REQUEST_URI', environ.get('PATH_INFO'))
if curr_loc:
if curr_loc and request_uri.startswith('/' + curr_loc + '/'):
return request_uri.replace(curr_loc, locale, 1)
app_prefix = environ.get('pywb.app_prefix', '')