summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Lib/mimetypes.py2
-rw-r--r--Misc/NEWS.d/next/Library/2025-01-15-12-04-30.gh-issue-128703.6WPf38.rst2
2 files changed, 4 insertions, 0 deletions
diff --git a/Lib/mimetypes.py b/Lib/mimetypes.py
index 7532383..3e1c3cf 100644
--- a/Lib/mimetypes.py
+++ b/Lib/mimetypes.py
@@ -90,6 +90,8 @@ class MimeTypes:
list of standard types, else to the list of non-standard
types.
"""
+ if not type:
+ return
self.types_map[strict][ext] = type
exts = self.types_map_inv[strict].setdefault(type, [])
if ext not in exts:
diff --git a/Misc/NEWS.d/next/Library/2025-01-15-12-04-30.gh-issue-128703.6WPf38.rst b/Misc/NEWS.d/next/Library/2025-01-15-12-04-30.gh-issue-128703.6WPf38.rst
new file mode 100644
index 0000000..1e6af90
--- /dev/null
+++ b/Misc/NEWS.d/next/Library/2025-01-15-12-04-30.gh-issue-128703.6WPf38.rst
@@ -0,0 +1,2 @@
+Fix :func:`mimetypes.guess_type` to use default mapping for empty
+``Content-Type`` in registry.