-
-
Notifications
You must be signed in to change notification settings - Fork 31.1k
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
Inconsistency with uppercase file extensions in MimeTypes.guess_type #64591
Comments
The functions looks up for the file extension in three maps: types_map, suffix_map and encodings_map. Lookup in types_map is case insensitive (by calling lower() first). These can lead to some seemingly counterintuitive results, like: a) b) c) Lookup should be case insensitive at least for the suffix_map, in which case (b) would be solved. The submitted patch implements this change. As for the encodings_map, I am not so sure, in particular because of the tar.Z extension. I found that the compress command expects the uppercase 'Z'. If someone is relying in the results of guess_type to call compress, errors could occur. |
I'm tagging this for 3.5 instead, since there are backward compatibility concerns and the 3.4 RC will probably be a couple weeks from now. |
Reproduced on 3.11. |
This implementation cannot find upercase extensions added via |
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:
The text was updated successfully, but these errors were encountered: