hgweb: fix NWI parsing when hgwebdir isn't at /
authorBrendan Cully <brendan@kublai.com>
Thu, 05 Oct 2006 14:45:15 -0700
changeset 3272 10277edf7e5b
parent 3271 36fa5db79dd5
child 3273 46188b9528ca
hgweb: fix NWI parsing when hgwebdir isn't at /
mercurial/hgweb/hgweb_mod.py
--- a/mercurial/hgweb/hgweb_mod.py	Thu Oct 05 14:27:14 2006 -0700
+++ b/mercurial/hgweb/hgweb_mod.py	Thu Oct 05 14:45:15 2006 -0700
@@ -653,11 +653,11 @@
                 def firstitem(query):
                     return query.split('&', 1)[0].split(';', 1)[0]
 
-                base = ''
+                root = req.env.get('SCRIPT_NAME', '')
                 if req.env.has_key('REPO_NAME'):
                     base = '/' + req.env['REPO_NAME']
-                elif req.env.get('SCRIPT_NAME'):
-                    base = req.env['SCRIPT_NAME']
+                else:
+                    base = root
 
                 pi = req.env.get('PATH_INFO')
                 if pi:
@@ -681,7 +681,7 @@
                     base += '?'
                     query = firstitem(req.env['QUERY_STRING'])
 
-                return (base, query)
+                return (root + base, query)
 
             req.url, query = spliturl(req)