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

Fixes environ paths when default_locale set (#873)

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.
This commit is contained in:
Ivan Jelenić 2023-11-23 16:56:26 +01:00 committed by GitHub
parent 79140441df
commit 013746c10a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -667,10 +667,14 @@ class FrontEndApp(object):
# 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)