]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-144217: Add dicom support (medical imaging) to mimetypes (GH-144218)
authorbenediktjohannes <benedikt.johannes.hofer@gmail.com>
Sun, 25 Jan 2026 22:22:43 +0000 (23:22 +0100)
committerGitHub <noreply@github.com>
Sun, 25 Jan 2026 22:22:43 +0000 (22:22 +0000)
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
Doc/whatsnew/3.15.rst
Lib/mimetypes.py
Lib/test/test_mimetypes.py
Misc/NEWS.d/next/Library/2026-01-25-03-23-20.gh-issue-144217.E1wVXH.rst [new file with mode: 0644]

index 8c3223d9a784a14783308d560f58da7f4bcef3a1..c412f48606c045d3b2af7c48eb43085cb16faa7f 100644 (file)
@@ -603,6 +603,7 @@ math
 mimetypes
 ---------
 
+* Add ``application/dicom`` MIME type for ``.dcm`` extension. (Contributed by Benedikt Johannes in :gh:`144217`.)
 * Add ``application/node`` MIME type for ``.cjs`` extension. (Contributed by John Franey in :gh:`140937`.)
 * Add ``application/toml``. (Contributed by Gil Forcada in :gh:`139959`.)
 * Rename ``application/x-texinfo`` to ``application/texinfo``.
index 07ac079186fbb7b49f4be08d874c35fe7a23f30a..361f924b55da1e5b8e6d60049974a814ae98c549 100644 (file)
@@ -477,6 +477,7 @@ def _default_mime_types():
     types_map = _types_map_default = {
         '.js'     : 'text/javascript',
         '.mjs'    : 'text/javascript',
+        '.dcm'    : 'application/dicom',
         '.epub'   : 'application/epub+zip',
         '.gz'     : 'application/gzip',
         '.json'   : 'application/json',
index 0f29640bc1c494fe5ec977f4a6dde59b6089b2a1..32adc59359108faabf404511b308b60626d7656b 100644 (file)
@@ -226,6 +226,7 @@ class MimeTypesTestCase(unittest.TestCase):
             for mime_type, ext in (
                 ("application/epub+zip", ".epub"),
                 ("application/octet-stream", ".bin"),
+                ("application/dicom", ".dcm"),
                 ("application/gzip", ".gz"),
                 ("application/ogg", ".ogx"),
                 ("application/pdf", ".pdf"),
diff --git a/Misc/NEWS.d/next/Library/2026-01-25-03-23-20.gh-issue-144217.E1wVXH.rst b/Misc/NEWS.d/next/Library/2026-01-25-03-23-20.gh-issue-144217.E1wVXH.rst
new file mode 100644 (file)
index 0000000..d85df59
--- /dev/null
@@ -0,0 +1 @@
+:mod:`mimetypes`: Add support for DICOM files (for medical imaging) with the official MIME type ``application/dicom``. Patch by Benedikt Johannes.