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.
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
That seems like a bug, the addition of .exe (1997) predates the official registration (2015) of the application/vnd.microsoft.portable-executable mimetype.
Activity
StanFromIreland commented on Nov 3, 2025
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:
ZeroIntensity commented on Nov 3, 2025
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.
StanFromIreland commented on Nov 3, 2025
The two cases you mentioned exist in mimetypes since 1997 (ac8a9f3), only in 2006 was the comment requiring they be registered added.
StanFromIreland commented on Nov 3, 2025
We can put it in common_types, which allows for non-IANA registered types. Per the documentation:
picnixz commented on Nov 3, 2025
FTR, mimetypes is supposed to be IANA compliant, as per the comment:
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.
johnfraney commented on Nov 4, 2025
Oh! Thank you, @StanFromIreland. I missed that comment. I'll put up a PR with that extension added to common_types instead
StanFromIreland commented on Nov 4, 2025
That seems like a bug, the addition of .exe (1997) predates the official registration (2015) of the application/vnd.microsoft.portable-executable mimetype.
gh-140942: Add MIME type for .cjs extension (#140937)
pythongh-140942: Add MIME type for .cjs extension (python#140937)