[PATCH 1 of 2] Minor hgwebdir tweaks

Bryan O'Sullivan bos at serpentine.com
Wed Aug 24 14:50:26 CDT 2005


- ignore / for PATH_INFO
- fix // in URLs


# HG changeset patch
# User mpm at selenic.com
# Node ID 31dcaf9123ba583094d6700b12484525974b96be
# Parent  a0ce13606208f4effc65d19a27905490c4f4f9ad
Minor hgwebdir tweaks

- ignore / for PATH_INFO
- fix // in URLs

diff -r a0ce13606208 -r 31dcaf9123ba mercurial/hgweb.py
--- a/mercurial/hgweb.py	Wed Aug 24 07:38:36 2005
+++ b/mercurial/hgweb.py	Wed Aug 24 10:32:08 2005
@@ -844,7 +844,7 @@
         except:
             virtual = ""
 
-        if virtual:
+        if virtual[1:]:
             real = self.cp.get("paths", virtual[1:])
             h = hgweb(real)
             h.run()
@@ -875,9 +875,12 @@
                     except:
                         return default
 
+                url = os.environ["REQUEST_URI"] + "/" + v
+                url = url.replace("//", "/")
+
                 yield dict(author = get("web", "author", "unknown"),
                            name = get("web", "name", v),
-                           url = os.environ["REQUEST_URI"] + "/" + v,
+                           url = url,
                            parity = parity,
                            shortdesc = get("web", "description", "unknown"),
                            lastupdate = os.stat(os.path.join(r, ".hg",


More information about the Mercurial mailing list