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

archivalrouter: make SCRIPT_NAME key lookup default to '', addresses #39

This commit is contained in:
Ilya Kreymer 2014-07-23 12:56:25 -07:00
parent 0b8a8f0ae2
commit 4d31c17d4c

View File

@ -49,12 +49,13 @@ class ArchivalRouter(object):
def parse_request(self, route, env, matcher, coll, request_uri,
use_abs_prefix=False):
matched_str = matcher.group(0)
rel_prefix = env.get('SCRIPT_NAME', '') + '/'
if matched_str:
rel_prefix = env['SCRIPT_NAME'] + '/' + matched_str + '/'
rel_prefix += matched_str + '/'
# remove the '/' + rel_prefix part of uri
wb_url_str = request_uri[len(matched_str) + 2:]
else:
rel_prefix = env['SCRIPT_NAME'] + '/'
# the request_uri is the wb_url, since no coll
wb_url_str = request_uri[1:]
@ -157,7 +158,7 @@ class ReferRedirect:
path = ref_split.path
app_path = env['SCRIPT_NAME']
app_path = env.get('SCRIPT_NAME', '')
if app_path:
# must start with current app name, if not root