--- a/mercurial/hgweb/hgwebdir_mod.py Wed Oct 04 17:04:40 2006 -0700
+++ b/mercurial/hgweb/hgwebdir_mod.py Wed Oct 04 17:04:40 2006 -0700
@@ -85,9 +85,10 @@
def archivelist(ui, nodeid, url):
allowed = ui.configlist("web", "allow_archive")
- for i in ['zip', 'gz', 'bz2']:
- if i in allowed or ui.configbool("web", "allow" + i):
- yield {"type" : i, "node": nodeid, "url": url}
+ for i in [('zip', '.zip'), ('gz', '.tar.gz'), ('bz2', '.tar.bz2')]:
+ if i[0] in allowed or ui.configbool("web", "allow" + i[0]):
+ yield {"type" : i[0], "extension": i[1],
+ "node": nodeid, "url": url}
def entries(sortcolumn="", descending=False, **map):
rows = []
@@ -101,7 +102,7 @@
get = u.config
url = ('/'.join([req.env["REQUEST_URI"].split('?')[0], name])
- .replace("//", "/"))
+ .replace("//", "/")) + '/'
# update time with local timezone
try:
@@ -143,8 +144,16 @@
virtual = req.env.get("PATH_INFO", "").strip('/')
if virtual:
- real = dict(self.repos).get(virtual)
+ 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:
hgweb(real).run_wsgi(req)
except IOError, inst: