mirror of
https://github.com/python/cpython.git
synced 2025-08-22 09:45:06 +00:00
bpo-35474: Fix mimetypes.guess_all_extensions() potentially mutating list (GH-28286)
* Calling guess_all_extensions() with strict=False potentially mutated types_map_inv. * Mutating the result of guess_all_extensions() mutated types_map_inv.
This commit is contained in:
parent
5f5b7d0c65
commit
97ea18eced
3 changed files with 20 additions and 8 deletions
|
@ -175,7 +175,7 @@ class MimeTypes:
|
|||
but non-standard types.
|
||||
"""
|
||||
type = type.lower()
|
||||
extensions = self.types_map_inv[True].get(type, [])
|
||||
extensions = list(self.types_map_inv[True].get(type, []))
|
||||
if not strict:
|
||||
for ext in self.types_map_inv[False].get(type, []):
|
||||
if ext not in extensions:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue