GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Add .cjs to mimetypes · Issue #140942 · python/cpython

Add .cjs to mimetypes #140942

New issue
Copy link
New issue
Copy link
Closed
#140937
Closed
Add .cjs to mimetypes#140942
#140937
Copy link
Labels
stdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytype-featureA feature request or enhancementA feature request or enhancement

Description

@johnfraney
johnfraney
opened on Nov 3, 2025
Issue body actions

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

  • gh-140942: Add MIME type for .cjs extension #140937

Activity

  1. johnfraney
    added
    type-featureA feature request or enhancementA feature request or enhancement
    on Nov 3, 2025
  2. StanFromIreland
    added
    stdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directory
    on Nov 3, 2025
  3. StanFromIreland commented on Nov 3, 2025

    @StanFromIreland
    StanFromIreland
    on Nov 3, 2025
    Member
    More actions

    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

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

    @ZeroIntensity
    ZeroIntensity
    on Nov 3, 2025
    Member
    More actions

    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.

  6. StanFromIreland commented on Nov 3, 2025

    @StanFromIreland
    StanFromIreland
    on Nov 3, 2025
    Member
    More actions

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

  7. StanFromIreland commented on Nov 3, 2025

    @StanFromIreland
    StanFromIreland
    on Nov 3, 2025
    Member
    More actions

    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.

    Reacted by Peter Bierma
  8. StanFromIreland
    removed
    pendingThe issue will be closed if no feedback is providedThe issue will be closed if no feedback is provided
    on Nov 3, 2025
  9. picnixz commented on Nov 3, 2025

    @picnixz
    picnixz
    on Nov 3, 2025
    Member
    More actions

    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.

  10. johnfraney commented on Nov 4, 2025

    @johnfraney
    johnfraney
    on Nov 4, 2025
    ContributorAuthor
    More actions

    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

  11. StanFromIreland commented on Nov 4, 2025

    @StanFromIreland
    StanFromIreland
    on Nov 4, 2025
    Member
    More actions

    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.

  12. hugovk
    closed this as completedin #140937on Nov 11, 2025
  13. hugovk
    added a commit that references this issue on Nov 11, 2025

    gh-140942: Add MIME type for .cjs extension (#140937)

    d890aba
  14. StanFromIreland
    added a commit that references this issue on Dec 6, 2025

    pythongh-140942: Add MIME type for .cjs extension (python#140937)

    1cf989e
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/ directoryStandard Library Python modules in the Lib/ directorytype-featureA feature request or enhancementA feature request or enhancement

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402503 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.