##// END OF EJS Templates
hgweb: use archivespecs for links on repo index page too...
av6 -
r30749:e38e7ea2 default
parent child Browse files
Show More
@@ -53,6 +53,12 b' perms = {'
53 53 'pushkey': 'push',
54 54 }
55 55
56 archivespecs = util.sortdict((
57 ('zip', ('application/zip', 'zip', '.zip', None)),
58 ('gz', ('application/x-gzip', 'tgz', '.tar.gz', None)),
59 ('bz2', ('application/x-bzip2', 'tbz2', '.tar.bz2', None)),
60 ))
61
56 62 def makebreadcrumb(url, prefix=''):
57 63 '''Return a 'URL breadcrumb' list
58 64
@@ -89,6 +95,8 b' class requestcontext(object):'
89 95 self.repo = repo
90 96 self.reponame = app.reponame
91 97
98 self.archivespecs = archivespecs
99
92 100 self.maxchanges = self.configint('web', 'maxchanges', 10)
93 101 self.stripecount = self.configint('web', 'stripes', 1)
94 102 self.maxshortchanges = self.configint('web', 'maxshortchanges', 60)
@@ -124,12 +132,6 b' class requestcontext(object):'
124 132 return self.repo.ui.configlist(section, name, default,
125 133 untrusted=untrusted)
126 134
127 archivespecs = util.sortdict((
128 ('zip', ('application/zip', 'zip', '.zip', None)),
129 ('gz', ('application/x-gzip', 'tgz', '.tar.gz', None)),
130 ('bz2', ('application/x-bzip2', 'tbz2', '.tar.bz2', None)),
131 ))
132
133 135 def archivelist(self, nodeid):
134 136 allowed = self.configlist('web', 'allow_archive')
135 137 for typ, spec in self.archivespecs.iteritems():
@@ -297,10 +297,10 b' class hgwebdir(object):'
297 297 def archivelist(ui, nodeid, url):
298 298 allowed = ui.configlist("web", "allow_archive", untrusted=True)
299 299 archives = []
300 for i in [('zip', '.zip'), ('gz', '.tar.gz'), ('bz2', '.tar.bz2')]:
301 if i[0] in allowed or ui.configbool("web", "allow" + i[0],
300 for typ, spec in hgweb_mod.archivespecs.iteritems():
301 if typ in allowed or ui.configbool("web", "allow" + typ,
302 302 untrusted=True):
303 archives.append({"type" : i[0], "extension": i[1],
303 archives.append({"type" : typ, "extension": spec[2],
304 304 "node": nodeid, "url": url})
305 305 return archives
306 306
General Comments 0
You need to be logged in to leave comments. Login now