FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Add .cjs to mimetypes · Issue #140942 · python/cpython · GitHub

Repository navigation

Add .cjs to mimetypes #140942

Closed
Closed

Description

Feature or enhancement

Proposal:

.cjs is a JavaScript extension for CommonJS modules and is used pretty commonly (ha) by JS like Vite. It's also a format that NodeJS supports.

It could be good to add it to mimetypes since it is a widely-used extension.

Has this already been discussed elsewhere?

This is a minor feature, which does not need previous discussion elsewhere

Links to previous discussion of this feature:

No response

Linked PRs

Activity

  1. added
    stdlibStandard Library Python modules in the Lib/ directory
    on Nov 3, 2025
  2. StanFromIreland commented on Nov 3, 2025

    Member

    I do not think this change is correct, it is not officially registered with IANA as required, .cjs is not listed as an alias of text/javascript:

    File extension(s): .js, .mjs

  3. added
    pendingThe issue will be closed if no feedback is provided
    on Nov 3, 2025
  4. ZeroIntensity commented on Nov 3, 2025

    Member

    I'm not sure that mimetypes is supposed to be 100% compliant with IANA. For example, we support the .jpe extension for JPEG files, despite that not being specified.

    There are also several supported extensions for application/octet-stream, and IANA doesn't specify any file extension for that. That suggests IANA's file extension specification isn't meant to be exhaustive.

  5. StanFromIreland commented on Nov 3, 2025

    Member

    The two cases you mentioned exist in mimetypes since 1997 (ac8a9f3), only in 2006 was the comment requiring they be registered added.

  6. StanFromIreland commented on Nov 3, 2025

    Member

    We can put it in common_types, which allows for non-IANA registered types. Per the documentation:

    The optional strict argument is a flag specifying whether the list of known MIME types is limited to only the official types registered with IANA.

  7. removed
    pendingThe issue will be closed if no feedback is provided
    on Nov 3, 2025
  8. picnixz commented on Nov 3, 2025

    Member

    FTR, mimetypes is supposed to be IANA compliant, as per the comment:

    # Before adding new types, make sure they are either registered with IANA,
    # at https://www.iana.org/assignments/media-types/media-types.xhtml
    # or extensions, i.e. using the x- prefix
    

    The reason why .exe & co are mapped to octect-stream is likely for convenience (the IANA type for .exe is https://www.iana.org/assignments/media-types/application/vnd.microsoft.portable-executable) and using octect-stream instead to indicate binary data is probably the best practical choice.

  9. johnfraney commented on Nov 4, 2025

    ContributorAuthor

    We can put it in common_types, which allows for non-IANA registered types. Per the documentation:

    Oh! Thank you, @StanFromIreland. I missed that comment. I'll put up a PR with that extension added to common_types instead

  10. StanFromIreland commented on Nov 4, 2025

    Member

    The reason why .exe & co are mapped to octect-stream is likely for convenience (the IANA type for .exe is https://www.iana.org/assignments/media-types/application/vnd.microsoft.portable-executable)

    That seems like a bug, the addition of .exe (1997) predates the official registration (2015) of the application/vnd.microsoft.portable-executable mimetype.

  11. added a commit that references this issue on Nov 11, 2025
  12. added a commit that references this issue on Dec 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    stdlibStandard Library Python modules in the Lib/ directorytype-featureA feature request or enhancement

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions


      Back | FazBrowse Home | New Git URL