hgweb: ignore web.templates config when guessing mime type for static content
Frozen binaries won't have a file-system path for static content, so
I'd like to remove dependence on that. From the documentation, it
seems like `mimetypes.guess_type()` only cares about the suffix, so I
think it should be enough to pass in just path under the
`web.templates` directory.
Differential Revision: https://phab.mercurial-scm.org/D8935
--- a/mercurial/hgweb/common.py Sat Aug 22 16:03:44 2020 -0700
+++ b/mercurial/hgweb/common.py Mon Aug 03 23:38:50 2020 -0700
@@ -201,7 +201,7 @@
try:
os.stat(path)
ct = pycompat.sysbytes(
- mimetypes.guess_type(pycompat.fsdecode(path))[0] or r"text/plain"
+ mimetypes.guess_type(pycompat.fsdecode(fpath))[0] or r"text/plain"
)
with open(path, b'rb') as fh:
data = fh.read()