changeset 1181:4f5001f5b4c3

Make sure the repository names don't have slashes at the at or else in some cases env[path_info] will not find an defined repository. REQUEST_URI can contain a query_string appending the repository name would lead to corrupt urls.
author Vincent Wagelaar <vincent@ricardis.tudelft.nl>
date Tue, 30 Aug 2005 21:58:44 +0200
parents fe3eb1628c40
children 24d553b598e8
files mercurial/hgweb.py
diffstat 1 files changed, 7 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/hgweb.py	Tue Aug 30 18:23:39 2005 +0200
+++ b/mercurial/hgweb.py	Tue Aug 30 21:58:44 2005 +0200
@@ -927,15 +927,18 @@
 # This is a stopgap
 class hgwebdir:
     def __init__(self, config):
+        def cleannames(items):
+            return [(name.strip('/'), path) for name, path in items]
+
         if type(config) == type([]):
-            self.repos = config
+            self.repos = cleannames(config)
         elif type(config) == type({}):
-            self.repos = config.items()
+            self.repos = cleannames(config.items())
             self.repos.sort()
         else:
             cp = ConfigParser.SafeConfigParser()
             cp.read(config)
-            self.repos = cp.items("paths")
+            self.repos = cleannames(cp.items("paths"))
             self.repos.sort()
 
     def run(self, req=hgrequest()):
@@ -956,7 +959,7 @@
                 u.readconfig(file(os.path.join(path, '.hg', 'hgrc')))
                 get = u.config
 
-                url = ('/'.join([req.env["REQUEST_URI"], name])
+                url = ('/'.join([req.env["REQUEST_URI"].split('?')[0], name])
                        .replace("//", "/"))
 
                 yield dict(contact=get("web", "contact") or