-
-
Notifications
You must be signed in to change notification settings - Fork 30.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
mimetypes module does not recognize jp2 type #85957
Comments
Even if jp2 is in the official list of types https://www.iana.org/assignments/media-types/media-types.xhtml it's not recognized by the MimeTypes.guess_type: >>> from mimetypes import MimeTypes
>>> MimeTypes().guess_type('test.jp2')
(None, None) The same example works in Python 3.7 and returns 'image/jp2' |
Hi, Radim! I've tested with 3.7.8 and got (None, None). I'm curious on how you got that 'image/jp2' output. It seems jp2 was never supported by looking into the git history of Lib/mimetypes.py. Would you like to open a PR to support it? :) |
Hi Andrés, tried again and the difference is between 3.7.4 and 3.7.5 I think it's because of using _types_map_default instead of types_map in some places. Since jp2 is an official mime type it should be added to the list but I also think we should try to identify the issue with _types_map_default. Seems to be related to https://bugs.python.org/issue4963 I will have look if I can find out what was changed and why. Cheers, |
Nice debugging! |
It is found by the module-level guess_type but not by the MimeType class's guess_type: >>> from mimetypes import MimeTypes
>>> MimeTypes().guess_type('test.jp2')
(None, None)
>>> import mimetypes
>>> mimetypes.guess_type('test.jp2')
('image/jp2', None)
>>> That difference is the subject of bpo-38656. What remains to decide here is whether jp2 should be added to the builtin list of mimetypes. |
mimetypes module does not find jp2 mime type on Windows. See python/cpython#85957
mimetypes module does not find jp2 mime type on Windows. See python/cpython#85957
mimetypes module does not find jp2 mime type on Windows. See python/cpython#85957
mimetypes module does not find jp2 mime type on Windows. See python/cpython#85957
mimetypes module does not find jp2 mime type on Windows. See python/cpython#85957
mimetypes module does not find jp2 mime type on Windows. See python/cpython#85957
Please see PR #126966. |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
Linked PRs
The text was updated successfully, but these errors were encountered: