Skip to content

Commit

Permalink
Fixes get_locale_prefixes() wrong paths (#874)
Browse files Browse the repository at this point in the history
If default_locale was set, and a web page was visited that doesn't have a langauge code in the path in the URL, the URL path parts returned by get_locale_prefixes() was wrong (e.g. /hrst/ instead of /hr/test/).
  • Loading branch information
Quirinus authored Nov 23, 2023
1 parent 013746c commit 7879dd0
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pywb/rewrite/templateview.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,11 +196,11 @@ def get_locale_prefixes(context):
orig_prefix = environ.get('pywb.app_prefix', '')
coll = environ.get('SCRIPT_NAME', '')

if orig_prefix:
if orig_prefix and coll.startswith(orig_prefix):
coll = coll[len(orig_prefix):]

curr_loc = environ.get('pywb_lang', '')
if curr_loc:
if curr_loc and coll.startswith('/' + curr_loc):
coll = coll[len(curr_loc) + 1:]

for locale in loc_map.keys():
Expand Down

0 comments on commit 7879dd0

Please sign in to comment.