From f504deff8f0d320767161162922cf7a7fa3aa0d2 Mon Sep 17 00:00:00 2001 From: Mathias Bynens Date: Tue, 10 May 2022 16:49:18 +0200 Subject: [PATCH 1/2] Correct JavaScript MIME types + extensions per RFC 9239 This patch updates the MIME type configuration per RFC 9239. https://www.rfc-editor.org/rfc/rfc9239 First, the recommended MIME type is now `text/javascript`: > The most widely supported media type in use is `text/javascript`; all > others are considered historical and obsolete aliases of `text/javascript`. Second, the `.mjs` extension is now explicitly registered: > The `.mjs` file extension signals that the file represents a JavaScript > module. Execution environments that rely on file extensions to > determine how to process inputs parse `.mjs` files using the Module > grammar of [ECMA-262]. IANA template: https://www.iana.org/assignments/media-types/text/javascript --- Lib/mimetypes.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Lib/mimetypes.py b/Lib/mimetypes.py index f6c43b3b92bc50..3224363a3f2bfb 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', From e574bf99f0cfbabafd3baa77df923269a9ff12d3 Mon Sep 17 00:00:00 2001 From: "blurb-it[bot]" <43283697+blurb-it[bot]@users.noreply.github.com> Date: Tue, 10 May 2022 14:52:30 +0000 Subject: [PATCH 2/2] =?UTF-8?q?=F0=9F=93=9C=F0=9F=A4=96=20Added=20by=20blu?= =?UTF-8?q?rb=5Fit.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../2022-05-10-14-52-29.gh-issue-92626._qhwB8.rst | 1 + 1 file changed, 1 insertion(+) create mode 100644 Misc/NEWS.d/next/Core and Builtins/2022-05-10-14-52-29.gh-issue-92626._qhwB8.rst diff --git a/Misc/NEWS.d/next/Core and Builtins/2022-05-10-14-52-29.gh-issue-92626._qhwB8.rst b/Misc/NEWS.d/next/Core and Builtins/2022-05-10-14-52-29.gh-issue-92626._qhwB8.rst new file mode 100644 index 00000000000000..4979c9e6a767ae --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/2022-05-10-14-52-29.gh-issue-92626._qhwB8.rst @@ -0,0 +1 @@ +Correct JavaScript MIME types + extensions per RFC 9239