Skip to content

gh-84852: Add MIME types for .eot, ,otf, .ttf, .woff and .woff2 fonts #20199

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 10 commits into from
Nov 12, 2024
10 changes: 10 additions & 0 deletions Doc/whatsnew/3.14.rst
Original file line number Diff line number Diff line change
Expand Up @@ -366,6 +366,16 @@ json
mimetypes
---------

* Add MS and :rfc:`8081` MIME types for fonts:

* Embedded OpenType: ``application/vnd.ms-fontobject``
* OpenType Layout (OTF) ``font/otf``
* TrueType: ``font/ttf``
* WOFF 1.0 ``font/woff``
* WOFF 2.0 ``font/woff2``

(Contributed by Sahil Prajapati and Hugo van Kemenade in :gh:`84852`.)

* Add :rfc:`9559` MIME types for Matroska audiovisual data container
structures, containing:

Expand Down
5 changes: 5 additions & 0 deletions Lib/mimetypes.py
Original file line number Diff line number Diff line change
Expand Up @@ -479,6 +479,7 @@ def _default_mime_types():
'.m3u8' : 'application/vnd.apple.mpegurl',
'.xls' : 'application/vnd.ms-excel',
'.xlb' : 'application/vnd.ms-excel',
'.eot' : 'application/vnd.ms-fontobject',
'.ppt' : 'application/vnd.ms-powerpoint',
'.pot' : 'application/vnd.ms-powerpoint',
'.ppa' : 'application/vnd.ms-powerpoint',
Expand Down Expand Up @@ -543,6 +544,10 @@ def _default_mime_types():
'.aiff' : 'audio/x-aiff',
'.ra' : 'audio/x-pn-realaudio',
'.wav' : 'audio/x-wav',
'.otf' : 'font/otf',
'.ttf' : 'font/ttf',
'.woff' : 'font/woff',
'.woff2' : 'font/woff2',
Comment on lines +547 to +550
Copy link
Member

Choose a reason for hiding this comment

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

I verified from the RFC that these 4 lines and hence the corresponding test lines are correct. There is no reference I see for the vnd-ms addition so cannot verify. The merge conflict will be in the tests due to the switch to using subtests, which looks good to me. So merge that first and fix this.

Copy link
Member

Choose a reason for hiding this comment

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

Thanks for verifying.

application/vnd.ms-fontobject is vendor specific and can be seen for example at:

'.avif' : 'image/avif',
'.bmp' : 'image/bmp',
'.gif' : 'image/gif',
Expand Down
5 changes: 5 additions & 0 deletions Lib/test/test_mimetypes.py
Original file line number Diff line number Diff line change
Expand Up @@ -228,12 +228,17 @@ def check_extensions():
("application/postscript", ".ps"),
("application/vnd.apple.mpegurl", ".m3u"),
("application/vnd.ms-excel", ".xls"),
("application/vnd.ms-fontobject", ".eot"),
("application/vnd.ms-powerpoint", ".ppt"),
("application/x-texinfo", ".texi"),
("application/x-troff", ".roff"),
("application/xml", ".xsl"),
("audio/matroska", ".mka"),
("audio/mpeg", ".mp3"),
("font/otf", ".otf"),
("font/ttf", ".ttf"),
("font/woff", ".woff"),
("font/woff2", ".woff2"),
("image/avif", ".avif"),
("image/webp", ".webp"),
("image/jpeg", ".jpg"),
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Add MIME types for MS Embedded OpenType, OpenType Layout, TrueType,
WOFF 1.0 and 2.0 fonts. Patch by Sahil Prajapati and Hugo van Kemenade.
Loading