comparison mercurial/hgweb/hgwebdir_mod.py @ 45378:dc9fe90bdbd5

hgweb: let staticfile() look up path from default location unless provided This reduces duplication between the two callers. Differential Revision: https://phab.mercurial-scm.org/D8934
author Martin von Zweigbergk <martinvonz@google.com>
date Sat, 22 Aug 2020 16:03:44 -0700
parents 1a4f925f72c3
children d4ba4d51f85f
comparison
equal deleted inserted replaced
45377:da3b7c80aa34 45378:dc9fe90bdbd5
411 if virtual.startswith(b'static/'): 411 if virtual.startswith(b'static/'):
412 fname = virtual[7:] 412 fname = virtual[7:]
413 else: 413 else:
414 fname = req.qsparams[b'static'] 414 fname = req.qsparams[b'static']
415 static = self.ui.config(b"web", b"static", untrusted=False) 415 static = self.ui.config(b"web", b"static", untrusted=False)
416 if not static: 416 staticfile(self.templatepath, static, fname, res)
417 tp = self.templatepath or templater.templatedir()
418 if tp is not None:
419 static = os.path.join(tp, b'static')
420
421 staticfile(static, fname, res)
422 return res.sendresponse() 417 return res.sendresponse()
423 418
424 # top-level index 419 # top-level index
425 420
426 repos = dict(self.repos) 421 repos = dict(self.repos)