Skip to content

Commit

Permalink
pythongh-128703: Fix mimetypes.guess_type for empty Content-Type in r…
Browse files Browse the repository at this point in the history
…egistry (pythonGH-128854)

(cherry picked from commit 303043f)

Co-authored-by: RUANG (James Roy) <longjinyii@outlook.com>
  • Loading branch information
rruuaanng authored and miss-islington committed Feb 14, 2025
1 parent 5e8a9eb commit 5cacca9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Lib/mimetypes.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,8 @@ def add_type(self, type, ext, strict=True):
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:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Fix :func:`mimetypes.guess_type` to use default mapping for empty
``Content-Type`` in registry.

0 comments on commit 5cacca9

Please # to comment.