gh-66543: Add mimetypes.guess_file_type() (GH-117258)

This commit is contained in:
Serhiy Storchaka 2024-05-06 15:50:52 +03:00 committed by GitHub
parent d3c7821335
commit d6fa1d4bee
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 129 additions and 35 deletions

View file

@ -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.