Skip to content

Commit 303043f

Browse files
authored
gh-128703: Fix mimetypes.guess_type for empty Content-Type in registry (GH-128854)
1 parent 3402e13 commit 303043f

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

Lib/mimetypes.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,8 @@ def add_type(self, type, ext, strict=True):
9090
list of standard types, else to the list of non-standard
9191
types.
9292
"""
93+
if not type:
94+
return
9395
self.types_map[strict][ext] = type
9496
exts = self.types_map_inv[strict].setdefault(type, [])
9597
if ext not in exts:
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Fix :func:`mimetypes.guess_type` to use default mapping for empty
2+
``Content-Type`` in registry.

0 commit comments

Comments
 (0)