This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Incorrect MIME type returned for .js files Windows 10.
Type: behavior Stage: resolved
Components: Library (Lib) Versions: Python 3.9
process
Status: closed Resolution: duplicate
Dependencies: Superseder: validate mime types loaded from system files. Document that system files take precedence.
View: 32462
Assigned To: Nosy List: smeans
Priority: normal Keywords:

Created on 2021-04-29 09:15 by smeans, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Messages (1)
msg392294 - (view) Author: Scott Means (smeans) Date: 2021-04-29 09:15
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.
History
Date User Action Args
2022-04-11 14:59:44adminsetgithub: 88141
2022-01-18 13:39:07iritkatrielsetstatus: open -> closed
superseder: validate mime types loaded from system files. Document that system files take precedence.
resolution: duplicate
stage: resolved
2021-04-29 09:15:48smeanscreate