mirror of
https://github.com/webrecorder/pywb.git
synced 2025-03-15 00:03:28 +01:00
Fixes get_locale_prefixes() wrong paths (#874)
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/).
This commit is contained in:
parent
013746c10a
commit
7879dd0222
@ -196,11 +196,11 @@ class JinjaEnv(object):
|
|||||||
orig_prefix = environ.get('pywb.app_prefix', '')
|
orig_prefix = environ.get('pywb.app_prefix', '')
|
||||||
coll = environ.get('SCRIPT_NAME', '')
|
coll = environ.get('SCRIPT_NAME', '')
|
||||||
|
|
||||||
if orig_prefix:
|
if orig_prefix and coll.startswith(orig_prefix):
|
||||||
coll = coll[len(orig_prefix):]
|
coll = coll[len(orig_prefix):]
|
||||||
|
|
||||||
curr_loc = environ.get('pywb_lang', '')
|
curr_loc = environ.get('pywb_lang', '')
|
||||||
if curr_loc:
|
if curr_loc and coll.startswith('/' + curr_loc):
|
||||||
coll = coll[len(curr_loc) + 1:]
|
coll = coll[len(curr_loc) + 1:]
|
||||||
|
|
||||||
for locale in loc_map.keys():
|
for locale in loc_map.keys():
|
||||||
|
Loading…
x
Reference in New Issue
Block a user