Mercurial > hg
changeset 51296:3972d090aba2
hgweb: update _runwsgi try/except range to be valid
The `tmpl` variable is used in the `except` and `finally`, so we need it created
before the `try` is open.
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Tue, 19 Dec 2023 21:38:46 +0100 |
parents | 011eec5a66b2 |
children | 4d12ffde8377 |
files | mercurial/hgweb/hgwebdir_mod.py |
diffstat | 1 files changed, 7 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/hgweb/hgwebdir_mod.py Tue Dec 19 21:36:52 2023 +0100 +++ b/mercurial/hgweb/hgwebdir_mod.py Tue Dec 19 21:38:46 2023 +0100 @@ -410,15 +410,15 @@ gc.collect(generation=1) def _runwsgi(self, req, res): - try: - self.refresh() + self.refresh() - csp, nonce = cspvalues(self.ui) - if csp: - res.headers[b'Content-Security-Policy'] = csp + csp, nonce = cspvalues(self.ui) + if csp: + res.headers[b'Content-Security-Policy'] = csp - virtual = req.dispatchpath.strip(b'/') - tmpl = self.templater(req, nonce) + virtual = req.dispatchpath.strip(b'/') + tmpl = self.templater(req, nonce) + try: ctype = tmpl.render(b'mimetype', {b'encoding': encoding.encoding}) # Global defaults. These can be overridden by any handler.