[Python-checkins] gh-97646: Change `.js` and `.mjs` files mimetype to conform to RFC 9239 (#97934)

ambv webhook-mailer at python.org
Fri Oct 7 15:01:01 EDT 2022


https://github.com/python/cpython/commit/2a168355f0b700d4a64ccb5de750eb9d485e1cc3
commit: 2a168355f0b700d4a64ccb5de750eb9d485e1cc3
branch: main
author: Noam Cohen <noam at noam.me>
committer: ambv <lukasz at langa.pl>
date: 2022-10-07T12:00:53-07:00
summary:

gh-97646: Change `.js` and `.mjs` files mimetype to conform to RFC 9239 (#97934)

files:
A Misc/NEWS.d/next/Library/2022-10-05-20-52-17.gh-issue-97646.Q4fVww.rst
M Lib/mimetypes.py

diff --git a/Lib/mimetypes.py b/Lib/mimetypes.py
index f6c43b3b92bc..3224363a3f2b 100644
--- a/Lib/mimetypes.py
+++ b/Lib/mimetypes.py
@@ -427,8 +427,8 @@ def _default_mime_types():
     # Make sure the entry with the preferred file extension for a particular mime type
     # appears before any others of the same mimetype.
     types_map = _types_map_default = {
-        '.js'     : 'application/javascript',
-        '.mjs'    : 'application/javascript',
+        '.js'     : 'text/javascript',
+        '.mjs'    : 'text/javascript',
         '.json'   : 'application/json',
         '.webmanifest': 'application/manifest+json',
         '.doc'    : 'application/msword',
diff --git a/Misc/NEWS.d/next/Library/2022-10-05-20-52-17.gh-issue-97646.Q4fVww.rst b/Misc/NEWS.d/next/Library/2022-10-05-20-52-17.gh-issue-97646.Q4fVww.rst
new file mode 100644
index 000000000000..6eed16c8e8bb
--- /dev/null
+++ b/Misc/NEWS.d/next/Library/2022-10-05-20-52-17.gh-issue-97646.Q4fVww.rst
@@ -0,0 +1 @@
+Replace deprecated ``application/javascript`` with ``text/javascript`` in :mod:`mimetypes`. See :rfc:`9239`. Patch by Noam Cohen.



More information about the Python-checkins mailing list