From 76d3ae71bab2f6391193610f4aedf8337be4112a Mon Sep 17 00:00:00 2001 From: benediktjohannes Date: Sun, 25 Jan 2026 23:22:43 +0100 Subject: [PATCH] gh-144217: Add dicom support (medical imaging) to mimetypes (GH-144218) Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com> Co-authored-by: Peter Bierma --- Doc/whatsnew/3.15.rst | 1 + Lib/mimetypes.py | 1 + Lib/test/test_mimetypes.py | 1 + .../next/Library/2026-01-25-03-23-20.gh-issue-144217.E1wVXH.rst | 1 + 4 files changed, 4 insertions(+) create mode 100644 Misc/NEWS.d/next/Library/2026-01-25-03-23-20.gh-issue-144217.E1wVXH.rst diff --git a/Doc/whatsnew/3.15.rst b/Doc/whatsnew/3.15.rst index 8c3223d9a784..c412f48606c0 100644 --- a/Doc/whatsnew/3.15.rst +++ b/Doc/whatsnew/3.15.rst @@ -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``. diff --git a/Lib/mimetypes.py b/Lib/mimetypes.py index 07ac079186fb..361f924b55da 100644 --- a/Lib/mimetypes.py +++ b/Lib/mimetypes.py @@ -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', diff --git a/Lib/test/test_mimetypes.py b/Lib/test/test_mimetypes.py index 0f29640bc1c4..32adc5935910 100644 --- a/Lib/test/test_mimetypes.py +++ b/Lib/test/test_mimetypes.py @@ -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 index 000000000000..d85df59b3749 --- /dev/null +++ b/Misc/NEWS.d/next/Library/2026-01-25-03-23-20.gh-issue-144217.E1wVXH.rst @@ -0,0 +1 @@ +:mod:`mimetypes`: Add support for DICOM files (for medical imaging) with the official MIME type ``application/dicom``. Patch by Benedikt Johannes. -- 2.47.3