From patchwork Tue Apr 10 15:41:40 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [7,of,8] hgweb: forward archivelist() of hgweb to webutil From: Yuya Nishihara X-Patchwork-Id: 30638 Message-Id: To: mercurial-devel@mercurial-scm.org Date: Wed, 11 Apr 2018 00:41:40 +0900 # HG changeset patch # User Yuya Nishihara # Date 1522590015 -32400 # Sun Apr 01 22:40:15 2018 +0900 # Node ID d9f6292315ef2e0000e355cccc3a6dc10c20eefd # Parent f698f65fbaf88305353eb769e0130299fc747f08 hgweb: forward archivelist() of hgweb to webutil self.configlist() is ui.configlist(untrusted=True), and url=None in templater effectively means 'url' is undefined. 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 @@ -128,10 +128,7 @@ class requestcontext(object): untrusted=untrusted) def archivelist(self, nodeid): - allowed = self.configlist('web', 'allow_archive') - for typ, spec in webutil.archivespecs.iteritems(): - if typ in allowed or self.configbool('web', 'allow%s' % typ): - yield {'type': typ, 'extension': spec[2], 'node': nodeid} + return webutil.archivelist(self.repo.ui, nodeid) def templater(self, req): # determine scheme, port and server name diff --git a/mercurial/hgweb/webutil.py b/mercurial/hgweb/webutil.py --- a/mercurial/hgweb/webutil.py +++ b/mercurial/hgweb/webutil.py @@ -49,7 +49,7 @@ archivespecs = util.sortdict(( ('bz2', ('application/x-bzip2', 'tbz2', '.tar.bz2', None)), )) -def archivelist(ui, nodeid, url): +def archivelist(ui, nodeid, url=None): allowed = ui.configlist('web', 'allow_archive', untrusted=True) archives = []