mirror of
https://github.com/python/cpython.git
synced 2025-08-04 17:08:35 +00:00
gh-66543: Add mimetypes.guess_file_type() (GH-117258)
This commit is contained in:
parent
d3c7821335
commit
d6fa1d4bee
8 changed files with 129 additions and 35 deletions
|
@ -53,7 +53,7 @@ must be running an SMTP server.
|
|||
# Guess the content type based on the file's extension. Encoding
|
||||
# will be ignored, although we should check for simple things like
|
||||
# gzip'd or compressed files.
|
||||
ctype, encoding = mimetypes.guess_type(path)
|
||||
ctype, encoding = mimetypes.guess_file_type(path)
|
||||
if ctype is None or encoding is not None:
|
||||
# No guess could be made, or the file is encoded (compressed), so
|
||||
# use a generic bag-of-bits type.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue