[PATCH] hgweb: make web.name default to repo basename

Steve Borho steve at borho.org
Thu Nov 29 20:47:53 CST 2007

# HG changeset patch
# User Steve Borho <steve at borho.org>
# Date 1196390861 21600
# Node ID febc72fa2f19a324a9c7238b46d0c11fc644256b
# Parent  feac5b0bf9bad2c125ebd5f3e133bcd46ecb8c7c
hgweb: make web.name default to repo basename

Providing the full path to the repository by default
could be considered a security risk.

diff --git a/mercurial/hgweb/hgweb_mod.py b/mercurial/hgweb/hgweb_mod.py
--- a/mercurial/hgweb/hgweb_mod.py
+++ b/mercurial/hgweb/hgweb_mod.py
@@ -828,7 +828,8 @@ class hgweb(object):
         if not self.reponame:
             self.reponame = (self.config("web", "name")
                              or req.env.get('REPO_NAME')
-                             or req.url.strip('/') or self.repo.root)
+                             or req.url.strip('/')
+                             or os.path.basename(self.repo.root))
         self.t = templater.templater(mapfile, templater.common_filters,
                                      defaults={"url": req.url,

More information about the Mercurial-devel mailing list