This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author cheryl.sabella
Recipients cheryl.sabella
Date 2017-12-31.11:07:48
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1514718469.31.0.467229070634.issue32462@psf.upfronthosting.co.za>
In-reply-to
Content
On a Windows 7 system, entering the following:

    >>> mime, encoding = mimetypes.guess_type('Untitled.sql')
    >>> mime
    'text\\plain'

Meaning, the return value is 'text\\plain' instead of 'text/plain'.  Tracking this down, it's due to .sql being loaded from the Windows registry and the registry is using the wrong slash.

The mimetypes.guess_type() documentation states:
> The return value is a tuple (type, encoding) where type is None if    > the type can’t be guessed (missing or unknown suffix) or a string of
> the form 'type/subtype', usable for a MIME content-type header.

I don't know if guess_type() (or add_types) should check for a valid types, if .sql should be added to the valid types (it's on the IANA page), or if the documentation should be fixed so it doesn't look like a guarantee.  Or all three.  :-)
History
Date User Action Args
2017-12-31 11:07:49cheryl.sabellasetrecipients: + cheryl.sabella
2017-12-31 11:07:49cheryl.sabellasetmessageid: <1514718469.31.0.467229070634.issue32462@psf.upfronthosting.co.za>
2017-12-31 11:07:49cheryl.sabellalinkissue32462 messages
2017-12-31 11:07:48cheryl.sabellacreate