[New-bugs-announce] [issue43975] Incorrect MIME type returned for .js files Windows 10.

Scott Means report at bugs.python.org
Thu Apr 29 05:15:48 EDT 2021


New submission from Scott Means <smeans at gmail.com>:

This isn't *technically* a bug in Python, but it really presents like one. I like to run the http.server for quick-and-dirty web development, but today Chrome refused to load any of my .js files because the server is returning a MIME type of 'text/plain'. I downloaded server.py and played with it for a while, and realized that mimetypes.guess_type() is returning 'text/plain' for .js files. So then I read further into the code and realized that mimetypes is harvesting MIME types from the Windows registry. And for some reason, at least on my machine, HKEY_CLASSES_ROOT\.js\Content Type was 'text/plain'. Changing it to 'application/javascript' fixed my issue, but I'm guessing that a lot of Python devs won't bother to dig this deep. I don't know what an appropriate fix would be, other than to probably trust the built-in MIME types over the ones harvested from Windows.

----------
components: Library (Lib)
messages: 392294
nosy: smeans
priority: normal
severity: normal
status: open
title: Incorrect MIME type returned for .js files Windows 10.
type: behavior
versions: Python 3.9

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue43975>
_______________________________________


More information about the New-bugs-announce mailing list