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 @@ -369,7 +369,7 @@ res.headers['Content-Security-Policy'] = csp wsgireq.headers.append(('Content-Security-Policy', csp)) - virtual = wsgireq.env.get("PATH_INFO", "").strip('/') + virtual = req.dispatchpath.strip('/') tmpl = self.templater(wsgireq, nonce) ctype = tmpl('mimetype', encoding=encoding.encoding) ctype = templater.stringify(ctype)