# HG changeset patch # User Martin von Zweigbergk # Date 2020-08-04 05:15:45 # Node ID 9a5c4875a88c9aeb23405e450b21291874285c10 # Parent e2320bb7a99fc738e099134ceef17858f1e58f4e hgweb: simplify staticfile() now that we always pass it a single directory I didn't realize this further simplifications enabled by D8786 until now. Differential Revision: https://phab.mercurial-scm.org/D8874 diff --git a/mercurial/hgweb/common.py b/mercurial/hgweb/common.py --- a/mercurial/hgweb/common.py +++ b/mercurial/hgweb/common.py @@ -191,12 +191,7 @@ def staticfile(directory, fname, res): return fpath = os.path.join(*fname.split(b'/')) - if isinstance(directory, bytes): - directory = [directory] - for d in directory: - path = os.path.join(d, fpath) - if os.path.exists(path): - break + path = os.path.join(directory, fpath) try: os.stat(path) ct = pycompat.sysbytes( diff --git a/mercurial/hgweb/hgwebdir_mod.py b/mercurial/hgweb/hgwebdir_mod.py --- a/mercurial/hgweb/hgwebdir_mod.py +++ b/mercurial/hgweb/hgwebdir_mod.py @@ -416,7 +416,7 @@ class hgwebdir(object): if not static: tp = self.templatepath or templater.templatedir() if tp is not None: - static = [os.path.join(tp, b'static')] + static = os.path.join(tp, b'static') staticfile(static, fname, res) return res.sendresponse() diff --git a/mercurial/hgweb/webcommands.py b/mercurial/hgweb/webcommands.py --- a/mercurial/hgweb/webcommands.py +++ b/mercurial/hgweb/webcommands.py @@ -1320,7 +1320,7 @@ def static(web): static = web.config(b"web", b"static", untrusted=False) if not static: tp = web.templatepath or templater.templatedir() - static = [os.path.join(tp, b'static')] + static = os.path.join(tp, b'static') staticfile(static, fname, web.res) return web.res.sendresponse()