--- a/mercurial/hgweb/hgwebdir_mod.py Sat Dec 01 19:10:00 2007 +0100
+++ b/mercurial/hgweb/hgwebdir_mod.py Sat Dec 01 19:19:08 2007 +0100
@@ -91,15 +91,11 @@
def config(section, name, default=None, untrusted=True):
return parentui.config(section, name, default, untrusted)
- url = req.env['REQUEST_URI'].split('?')[0]
+ url = req.env.get('SCRIPT_NAME', '')
if not url.endswith('/'):
url += '/'
- pathinfo = req.env.get('PATH_INFO', '').strip('/') + '/'
- base = url[:len(url) - len(pathinfo)]
- if not base.endswith('/'):
- base += '/'
- staticurl = config('web', 'staticurl') or base + 'static/'
+ staticurl = config('web', 'staticurl') or url + 'static/'
if not staticurl.endswith('/'):
staticurl += '/'
@@ -158,8 +154,10 @@
if u.configbool("web", "hidden", untrusted=True):
continue
- url = ('/'.join([req.env["REQUEST_URI"].split('?')[0], name])
- .replace("//", "/")) + '/'
+ parts = [req.env['PATH_INFO'], name]
+ if req.env['SCRIPT_NAME']:
+ parts.insert(0, req.env['SCRIPT_NAME'])
+ url = ('/'.join(parts).replace("//", "/")) + '/'
# update time with local timezone
try: