Last change broke new-style URLs
authorBrendan Cully <brendan@kublai.com>
Fri, 06 Jul 2007 10:11:48 -0700
changeset 4846 40007fe82be9
parent 4845 4f86c58c6c56
child 4847 845e0071b704
Last change broke new-style URLs
mercurial/hgweb/hgwebdir_mod.py
--- a/mercurial/hgweb/hgwebdir_mod.py	Fri Jul 06 09:15:17 2007 -0700
+++ b/mercurial/hgweb/hgwebdir_mod.py	Fri Jul 06 10:11:48 2007 -0700
@@ -220,7 +220,15 @@
                 req.write(staticfile(static, fname, req) or
                           tmpl('error', error='%r not found' % fname))
             elif virtual:
-                if virtual in dict(self.repos):
+                while virtual:
+                    real = dict(self.repos).get(virtual)
+                    if real:
+                        break
+                    up = virtual.rfind('/')
+                    if up < 0:
+                        break
+                    virtual = virtual[:up]
+                if real:
                     req.env['REPO_NAME'] = virtual
                     try:
                         repo = hg.repository(parentui, real)
@@ -230,7 +238,7 @@
                     except hg.RepoError, inst:
                         req.write(tmpl("error", error=str(inst)))
                 else:
-                    subdir=virtual + '/'
+                    subdir=req.env.get("PATH_INFO", "").strip('/') + '/'
                     if [r for r in self.repos if r[0].startswith(subdir)]:
                         makeindex(req, subdir)
                     else: