gh-128703: Fix mimetypes.guess_type for empty Content-Type in registry (GH-128854)

(cherry picked from commit 303043f506)

Co-authored-by: RUANG (James Roy) <longjinyii@outlook.com>
This commit is contained in:
Miss Islington (bot) 2025-02-17 16:36:49 +01:00 committed by GitHub
parent 320316ef7e
commit d78e113d1b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 4 additions and 0 deletions

View file

@ -95,6 +95,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: