https://github.com/python/cpython/commit/933f21c3c92f758fb0615d6a4cca10249c686ae7
commit: 933f21c3c92f758fb0615d6a4cca10249c686ae7
branch: main
author: Hugo van Kemenade <[email protected]>
committer: hugovk <[email protected]>
date: 2024-11-18T20:13:20+02:00
summary:

gh-85957: Add missing MIME types for images with RFCs (#126966)

files:
A Misc/NEWS.d/next/Library/2024-11-18-15-33-25.gh-issue-85957.8gT3B-.rst
M Doc/whatsnew/3.14.rst
M Lib/mimetypes.py
M Lib/test/test_mimetypes.py

diff --git a/Doc/whatsnew/3.14.rst b/Doc/whatsnew/3.14.rst
index 8196250d784843..f2c357b1ebc709 100644
--- a/Doc/whatsnew/3.14.rst
+++ b/Doc/whatsnew/3.14.rst
@@ -396,6 +396,17 @@ mimetypes
 
   (Contributed by Hugo van Kemenade in :gh:`89416`.)
 
+* Add MIME types for images with RFCs:
+
+  * :rfc:`1494`: CCITT Group 3 (``.g3``)
+  * :rfc:`3362`: Real-time Facsimile, T.38 (``.t38``)
+  * :rfc:`3745`: JPEG 2000 (``.jp2``), extension (``.jpx``) and compound 
(``.jpm``)
+  * :rfc:`3950`: Tag Image File Format Fax eXtended, TIFF-FX (``.tfx``)
+  * :rfc:`4047`: Flexible Image Transport System (``.fits``)
+  * :rfc:`7903`: Enhanced Metafile (``.emf``) and Windows Metafile (``.wmf``)
+
+  (Contributed by Hugo van Kemenade in :gh:`85957`.)
+
 
 multiprocessing
 ---------------
diff --git a/Lib/mimetypes.py b/Lib/mimetypes.py
index 210d2264757d08..61cba1ac4932d0 100644
--- a/Lib/mimetypes.py
+++ b/Lib/mimetypes.py
@@ -550,19 +550,28 @@ def _default_mime_types():
         '.woff2'  : 'font/woff2',
         '.avif'   : 'image/avif',
         '.bmp'    : 'image/bmp',
+        '.emf'    : 'image/emf',
+        '.fits'   : 'image/fits',
+        '.g3'     : 'image/g3fax',
         '.gif'    : 'image/gif',
         '.ief'    : 'image/ief',
+        '.jp2'    : 'image/jp2',
         '.jpg'    : 'image/jpeg',
         '.jpe'    : 'image/jpeg',
         '.jpeg'   : 'image/jpeg',
+        '.jpm'    : 'image/jpm',
+        '.jpx'    : 'image/jpx',
         '.heic'   : 'image/heic',
         '.heif'   : 'image/heif',
         '.png'    : 'image/png',
         '.svg'    : 'image/svg+xml',
+        '.t38'    : 'image/t38',
         '.tiff'   : 'image/tiff',
         '.tif'    : 'image/tiff',
+        '.tfx'    : 'image/tiff-fx',
         '.ico'    : 'image/vnd.microsoft.icon',
         '.webp'   : 'image/webp',
+        '.wmf'    : 'image/wmf',
         '.ras'    : 'image/x-cmu-raster',
         '.pnm'    : 'image/x-portable-anymap',
         '.pbm'    : 'image/x-portable-bitmap',
diff --git a/Lib/test/test_mimetypes.py b/Lib/test/test_mimetypes.py
index c4bb8dfb1a7422..0a5b511e75537c 100644
--- a/Lib/test/test_mimetypes.py
+++ b/Lib/test/test_mimetypes.py
@@ -240,9 +240,17 @@ def check_extensions():
                 ("font/woff", ".woff"),
                 ("font/woff2", ".woff2"),
                 ("image/avif", ".avif"),
+                ("image/emf", ".emf"),
+                ("image/fits", ".fits"),
+                ("image/g3fax", ".g3"),
+                ("image/jp2", ".jp2"),
+                ("image/jpm", ".jpm"),
+                ("image/t38", ".t38"),
                 ("image/webp", ".webp"),
+                ("image/wmf", ".wmf"),
                 ("image/jpeg", ".jpg"),
                 ("image/tiff", ".tiff"),
+                ("image/tiff-fx", ".tfx"),
                 ("message/rfc822", ".eml"),
                 ("text/html", ".html"),
                 ("text/plain", ".txt"),
diff --git 
a/Misc/NEWS.d/next/Library/2024-11-18-15-33-25.gh-issue-85957.8gT3B-.rst 
b/Misc/NEWS.d/next/Library/2024-11-18-15-33-25.gh-issue-85957.8gT3B-.rst
new file mode 100644
index 00000000000000..02d3fe3077e4d1
--- /dev/null
+++ b/Misc/NEWS.d/next/Library/2024-11-18-15-33-25.gh-issue-85957.8gT3B-.rst
@@ -0,0 +1,2 @@
+Add missing MIME types for images with RFCs: emf, fits, g3fax, jp2, jpm,
+jpx, t38, tiff-fx and wmf. Patch by Hugo van Kemenade.

_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-checkins.python.org/
Member address: [email protected]

Reply via email to