Skip to content

Commit

Permalink
Fixes environ paths when default_locale set (#873)
Browse files Browse the repository at this point in the history
If the default_locale was set and the URL path didn't contain a language code, it was behaving as if there was a language code in the URL. In that case, it was moving part of the PATH_INFO to SCRIPT_NAME, but as there wasn't any language code in the URL, it moved something else. This fixes that.
  • Loading branch information
Quirinus authored Nov 23, 2023
1 parent 7914044 commit 013746c
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion pywb/apps/frontendapp.py
Original file line number Diff line number Diff line change
Expand Up @@ -667,10 +667,14 @@ def handle_request(self, environ, start_response):
# store original script_name (original prefix) before modifications are made
environ['ORIG_SCRIPT_NAME'] = environ.get('SCRIPT_NAME')

lang = args.pop('lang', self.default_locale)
lang = args.pop('lang', '')
if lang:
pop_path_info(environ)

if lang:
environ['pywb_lang'] = lang
elif self.default_locale:
environ['pywb_lang'] = self.default_locale

response = endpoint(environ, **args)

Expand Down

0 comments on commit 013746c

Please sign in to comment.