Skip to content

gh-129965: Add more missing MIME types #132845

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

Merged
merged 14 commits into from
Apr 28, 2025
Merged

Conversation

hugovk
Copy link
Member

@hugovk hugovk commented Apr 23, 2025

Based on the last list here:

uv run --python python3.14 --with content-types https://raw.githubusercontent.com/mikeckennedy/content-types/refs/heads/main/samples/compare_to_builtin.py
Compare types in mimetypes vs content-types.
There are 6 types where mimetypes and content-types disagree
mimetypes: .avi video/vnd.avi, content-types: .avi video/x-msvideo
mimetypes: .dll application/octet-stream, content-types: .dll application/x-msdownload
mimetypes: .exe application/octet-stream, content-types: .exe application/x-msdownload
mimetypes: .obj application/octet-stream, content-types: .obj model/obj
mimetypes: .wav audio/vnd.wave, content-types: .wav audio/wav
mimetypes: .xml text/xml, content-types: .xml application/xml

There are 14 types in mimetypes that are not in content-types
.emf : image/emf
.eot : application/vnd.ms-fontobject
.fits: image/fits
.g3  : image/g3fax
.jp2 : image/jp2
.jpm : image/jpm
.jpx : image/jpx
.mk3d: video/matroska-3d
.mka : audio/matroska
.mkv : video/matroska
.ogx : application/ogg
.t38 : image/t38
.tfx : image/tiff-fx
.wmf : image/wmf

There are 14 types in content-types that are not in mimetypes
.7z    -> application/x-7z-compressed
.apk   -> application/vnd.android.package-archive
.deb   -> application/x-debian-package
.glb   -> model/gltf-binary
.gltf  -> model/gltf+json
.gz    -> application/gzip
.m4v   -> video/mp4
.map   -> application/json
.php   -> application/x-httpd-php
.rar   -> application/vnd.rar
.rpm   -> application/x-rpm
.stl   -> model/stl
.tgz   -> application/gzip
.wmv   -> video/x-ms-wmv

I used the MIME types from the following sources.

From https://developer.mozilla.org/en-US/docs/Web/HTTP/Guides/MIME_types/Common_types

  • application/x-httpd-php

From Wikipedia:

  • application/vnd.android.package-archive (added to non-strict list because not in IANA or x- prefix)
  • application/x-7z-compressed
  • video/x-m4v

From https://mimetype.io

  • application/x-debian-package
  • application/x-rpm

From https://learn.microsoft.com/en-us/previous-versions/windows/desktop/wmp/file-name-extensions

  • video/x-ms-wmv

All the rest from https://www.iana.org/assignments/media-types/media-types.xhtml


I didn't add these because they're not in IANA or MDN, and I didn't find any authoritative sources:

.map   -> application/json
.tgz   -> application/gzip

📚 Documentation preview 📚: https://cpython-previews--132845.org.readthedocs.build/

@hugovk hugovk added the type-feature A feature request or enhancement label Apr 23, 2025
@hugovk hugovk requested a review from a team as a code owner April 23, 2025 16:06
@bedevere-app bedevere-app bot mentioned this pull request Apr 23, 2025
Comment on lines 969 to 970
Add EPUB ``application/epub+zip`` (``.epub``)
* Add 7z ``application/x-7z-compressed`` (``.7z``)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Keep this list sorted? It's unclear if the new additions fall under the 'de facto' category or if some of them have standards bodies, like above.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated!

It may be clearer to rewrite a bunch of these addition bullets together, even though they were contributed across a few issues. But that can be future copyediting.

@hugovk hugovk enabled auto-merge (squash) April 28, 2025 15:16
@hugovk hugovk merged commit 4cec0b5 into python:main Apr 28, 2025
42 of 43 checks passed
@hugovk hugovk deleted the 3.14-more-mimetypes branch April 28, 2025 15:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type-feature A feature request or enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants