Skip to content

Commit

Permalink
Fixes switch_locale not adding locale if missing from URL (#871)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Quirinus authored Nov 23, 2023
1 parent af92a97 commit 7914044
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion pywb/rewrite/templateview.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ def switch_locale(context, locale):

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', '')
Expand Down

0 comments on commit 7914044

Please sign in to comment.