mirror of
https://github.com/python/cpython.git
synced 2025-08-04 17:08:35 +00:00
gh-129965: Add more missing MIME types (#132845)
This commit is contained in:
parent
c2eaeee3dc
commit
4cec0b510b
4 changed files with 40 additions and 2 deletions
|
@ -1001,9 +1001,22 @@ mimetypes
|
|||
|
||||
* :rfc:`2361`: Change type for ``.avi`` to ``video/vnd.avi``
|
||||
and for ``.wav`` to ``audio/vnd.wave``
|
||||
* :rfc:`4337`: Add MPEG-4 ``audio/mp4`` (``.m4a``))
|
||||
* :rfc:`4337`: Add MPEG-4 ``audio/mp4`` (``.m4a``)
|
||||
* :rfc:`5334`: Add Ogg media (``.oga``, ``.ogg`` and ``.ogx``)
|
||||
* :rfc:`6713`: Add gzip ``application/gzip`` (``.gz``)
|
||||
* :rfc:`9639`: Add FLAC ``audio/flac`` (``.flac``)
|
||||
* Add 7z ``application/x-7z-compressed`` (``.7z``)
|
||||
* Add Android Package ``application/vnd.android.package-archive`` (``.apk``)
|
||||
when not strict
|
||||
* Add deb ``application/x-debian-package`` (``.deb``)
|
||||
* Add glTF binary ``model/gltf-binary`` (``.glb``)
|
||||
* Add glTF JSON/ASCII ``model/gltf+json`` (``.gltf``)
|
||||
* Add M4V ``video/x-m4v`` (``.m4v``)
|
||||
* Add PHP ``application/x-httpd-php`` (``.php``)
|
||||
* Add RAR ``application/vnd.rar`` (``.rar``)
|
||||
* Add RPM ``application/x-rpm`` (``.rpm``)
|
||||
* Add STL ``model/stl`` (``.stl``)
|
||||
* Add Windows Media Video ``video/x-ms-wmv`` (``.wmv``)
|
||||
* De facto: Add WebM ``audio/webm`` (``.weba``)
|
||||
* `ECMA-376
|
||||
<https://ecma-international.org/publications-and-standards/standards/ecma-376/>`__:
|
||||
|
|
|
@ -478,6 +478,7 @@ def _default_mime_types():
|
|||
'.js' : 'text/javascript',
|
||||
'.mjs' : 'text/javascript',
|
||||
'.epub' : 'application/epub+zip',
|
||||
'.gz' : 'application/gzip',
|
||||
'.json' : 'application/json',
|
||||
'.webmanifest': 'application/manifest+json',
|
||||
'.doc' : 'application/msword',
|
||||
|
@ -517,10 +518,13 @@ def _default_mime_types():
|
|||
'.pptx' : 'application/vnd.openxmlformats-officedocument.presentationml.presentation',
|
||||
'.xlsx' : 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
|
||||
'.docx' : 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
|
||||
'.rar' : 'application/vnd.rar',
|
||||
'.wasm' : 'application/wasm',
|
||||
'.7z' : 'application/x-7z-compressed',
|
||||
'.bcpio' : 'application/x-bcpio',
|
||||
'.cpio' : 'application/x-cpio',
|
||||
'.csh' : 'application/x-csh',
|
||||
'.deb' : 'application/x-debian-package',
|
||||
'.dvi' : 'application/x-dvi',
|
||||
'.gtar' : 'application/x-gtar',
|
||||
'.hdf' : 'application/x-hdf',
|
||||
|
@ -530,10 +534,12 @@ def _default_mime_types():
|
|||
'.cdf' : 'application/x-netcdf',
|
||||
'.nc' : 'application/x-netcdf',
|
||||
'.p12' : 'application/x-pkcs12',
|
||||
'.php' : 'application/x-httpd-php',
|
||||
'.pfx' : 'application/x-pkcs12',
|
||||
'.ram' : 'application/x-pn-realaudio',
|
||||
'.pyc' : 'application/x-python-code',
|
||||
'.pyo' : 'application/x-python-code',
|
||||
'.rpm' : 'application/x-rpm',
|
||||
'.sh' : 'application/x-sh',
|
||||
'.shar' : 'application/x-shar',
|
||||
'.swf' : 'application/x-shockwave-flash',
|
||||
|
@ -623,6 +629,9 @@ def _default_mime_types():
|
|||
'.mht' : 'message/rfc822',
|
||||
'.mhtml' : 'message/rfc822',
|
||||
'.nws' : 'message/rfc822',
|
||||
'.gltf' : 'model/gltf+json',
|
||||
'.glb' : 'model/gltf-binary',
|
||||
'.stl' : 'model/stl',
|
||||
'.css' : 'text/css',
|
||||
'.csv' : 'text/csv',
|
||||
'.html' : 'text/html',
|
||||
|
@ -661,6 +670,8 @@ def _default_mime_types():
|
|||
'.qt' : 'video/quicktime',
|
||||
'.webm' : 'video/webm',
|
||||
'.avi' : 'video/vnd.avi',
|
||||
'.m4v' : 'video/x-m4v',
|
||||
'.wmv' : 'video/x-ms-wmv',
|
||||
'.movie' : 'video/x-sgi-movie',
|
||||
}
|
||||
|
||||
|
@ -670,6 +681,7 @@ def _default_mime_types():
|
|||
# Please sort these too
|
||||
common_types = _common_types_default = {
|
||||
'.rtf' : 'application/rtf',
|
||||
'.apk' : 'application/vnd.android.package-archive',
|
||||
'.midi': 'audio/midi',
|
||||
'.mid' : 'audio/midi',
|
||||
'.jpg' : 'image/jpg',
|
||||
|
|
|
@ -7,7 +7,6 @@ import unittest.mock
|
|||
from platform import win32_edition
|
||||
from test import support
|
||||
from test.support import os_helper
|
||||
from test.support.script_helper import run_python_until_end
|
||||
|
||||
try:
|
||||
import _winapi
|
||||
|
@ -227,6 +226,7 @@ class MimeTypesTestCase(unittest.TestCase):
|
|||
for mime_type, ext in (
|
||||
("application/epub+zip", ".epub"),
|
||||
("application/octet-stream", ".bin"),
|
||||
("application/gzip", ".gz"),
|
||||
("application/ogg", ".ogx"),
|
||||
("application/postscript", ".ps"),
|
||||
("application/vnd.apple.mpegurl", ".m3u"),
|
||||
|
@ -240,6 +240,11 @@ class MimeTypesTestCase(unittest.TestCase):
|
|||
("application/vnd.openxmlformats-officedocument.presentationml.presentation", ".pptx"),
|
||||
("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", ".xlsx"),
|
||||
("application/vnd.openxmlformats-officedocument.wordprocessingml.document", ".docx"),
|
||||
("application/vnd.rar", ".rar"),
|
||||
("application/x-7z-compressed", ".7z"),
|
||||
("application/x-debian-package", ".deb"),
|
||||
("application/x-httpd-php", ".php"),
|
||||
("application/x-rpm", ".rpm"),
|
||||
("application/x-texinfo", ".texi"),
|
||||
("application/x-troff", ".roff"),
|
||||
("application/xml", ".xsl"),
|
||||
|
@ -268,6 +273,9 @@ class MimeTypesTestCase(unittest.TestCase):
|
|||
("image/webp", ".webp"),
|
||||
("image/wmf", ".wmf"),
|
||||
("message/rfc822", ".eml"),
|
||||
("model/gltf+json", ".gltf"),
|
||||
("model/gltf-binary", ".glb"),
|
||||
("model/stl", ".stl"),
|
||||
("text/html", ".html"),
|
||||
("text/plain", ".txt"),
|
||||
("text/rtf", ".rtf"),
|
||||
|
@ -278,6 +286,8 @@ class MimeTypesTestCase(unittest.TestCase):
|
|||
("video/ogg", ".ogv"),
|
||||
("video/quicktime", ".mov"),
|
||||
("video/vnd.avi", ".avi"),
|
||||
("video/x-m4v", ".m4v"),
|
||||
("video/x-ms-wmv", ".wmv"),
|
||||
):
|
||||
with self.subTest(mime_type=mime_type, ext=ext):
|
||||
self.assertEqual(mimetypes.guess_extension(mime_type), ext)
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
Add MIME types for ``.7z``, ``.apk``, ``.deb``, ``.glb``, ``.gltf``,
|
||||
``.gz``, ``.m4v``, ``.php``, ``.rar``, ``.rpm``, ``.stl`` and ``.wmv``.
|
||||
Patch by Hugo van Kemenade.
|
Loading…
Add table
Add a link
Reference in a new issue