-
-
Notifications
You must be signed in to change notification settings - Fork 30.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
bpo-31715 Add mimetype for extension .mjs #3908
Conversation
Hello, and thanks for your contribution! I'm a bot set up to make sure that the project can legally accept your contribution by verifying you have signed the PSF contributor agreement (CLA). Unfortunately our records indicate you have not signed the CLA. For legal reasons we need you to sign this before we can look at your contribution. Please follow the steps outlined in the CPython devguide to rectify this issue. Thanks again to your contribution and we look forward to looking at it! |
The CLA has now been signed, is there anything blocking this? |
Needs review from @python/email-team and news entry. |
Thanks @Mariatta I've send @bmeck a PR that includes the news entry in bmeck@f54e12c Does it look like I did that correctly? |
@MylesBorins The news entry lgtm. If @bmeck ended up accepting your PR, then you should sign Python's CLA too. And we'll need to make sure to add |
update news
Hello, and thanks for your contribution! I'm a bot set up to make sure that the project can legally accept your contribution by verifying you have signed the PSF contributor agreement (CLA). Unfortunately our records indicate you have not signed the CLA. For legal reasons we need you to sign this before we can look at your contribution. Please follow the steps outlined in the CPython devguide to rectify this issue. You can check yourself to see if the CLA has been received. Thanks again for your contribution, we look forward to reviewing it! |
CLA is confirmed if you want to re-run commit bot |
here's an example of this biting people in the wild https://twitter.com/kuvos/status/1046984084575150082 Anyway we could get review on this? |
I'll leave the argument to someone more familiar with RFC details on mimetypes (there are 3+ RFCs on this), but I think we should maintain consistency between our support of .js and .mjs files. Currently, .js files are @MylesBorins or @bmeck, do you see a reason to support |
@emilyemorehouse per the up to date HTML standard |
Sounds good, I'd make the argument that both should use |
I've opened #9678 and https://bugs.python.org/issue34875 to update the mimetype of |
Lib/mimetypes.py
Outdated
@@ -450,6 +450,7 @@ def _default_mime_types(): | |||
'.mht' : 'message/rfc822', | |||
'.mhtml' : 'message/rfc822', | |||
'.mif' : 'application/x-mif', | |||
'.mjs' : 'text/javascript', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It should be application/javascript
for consistency with .js
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
text/javascript
is correct, and .js
should be changed to use it as well. Please see the discussion above. #3908 (comment)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
asveltov's rationale for application/javascript
is explained here: https://bugs.python.org/issue34875
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would you be open to adding .mjs
support with application/javascript
until https://datatracker.ietf.org/doc/draft-ietf-dispatch-javascript-mjs/ gets officially accepted? It would be better to have some support than to have none at all, given that people are already running into issues with SimpleHTTPServer
.
Note that Google Chrome already explicitly supports mjs
: https://chromium-review.googlesource.com/c/chromium/src/+/1117070 (with text/javascript
)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Re-reading this, it sounds like you are open to that. That’s great! I look forward to Python supporting mjs
, and eventually serving it as text/javascript
.
…to fix-issue-31715
I have made the requested changes; please review again. |
Thanks for making the requested changes! @asvetlov: please review the changes made to this pull request. |
Add mimetype for file extension ``.mjs``. This will allow ``python -m`` to | ||
support applications attempting to load ECMAScript Modules with the ``.mjs`` | ||
extension. | ||
Assiciate ``.mjs`` file extension with ``application/javascript`` MIME Type. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Associate
@asvetlov: Please replace |
(cherry picked from 0854b92)
(chery picked from commit 0854b92)
(cherry picked from commit 0854b92)
(cherry picked from commit 0854b92)
…onGH-10977) (cherry picked from commit 0854b92)
see https://bugs.python.org/issue31715
https://bugs.python.org/issue31715