hgweb: Added safety net for PATH_INFO starting with double slash.
authorThomas Arendsen Hein <thomas@intevation.de>
Thu, 05 Oct 2006 11:57:38 +0200
changeset 3266 b4f16bf59a5d
parent 3265 03880d4e2550
child 3267 bb057b6ce3cf
hgweb: Added safety net for PATH_INFO starting with double slash. This happens e.g. when using the following apache config: RewriteRule (.*) /hgwebdir/$1 [PT] instead of the less readable (but more correct): RewriteRule (.*) /hgwebdir$1 [PT]
mercurial/hgweb/hgweb_mod.py
--- a/mercurial/hgweb/hgweb_mod.py
+++ b/mercurial/hgweb/hgweb_mod.py
@@ -660,6 +660,8 @@ class hgweb(object):
 
                 pi = req.env.get('PATH_INFO')
                 if pi:
+                    while pi.startswith('//'):
+                        pi = pi[1:]
                     if pi.startswith(base):
                         if len(pi) > len(base):
                             base += '/'