-
Notifications
You must be signed in to change notification settings - Fork 57
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
The suggested extension for image/jpeg should probably be "jpeg" or "jpg", not "jpe" #59
Comments
This isn't trivial. Reverse mappings are returned in lexicographical order because the source list is sorted in lexicographical order. To give the reverse mapping the correct priority we'd either have to break the sort order of the source list (which would make it a pain to maintain), or we have to assign a key for reverse-mapping priority for each entry. I think the latter is probably the best. |
Thinking about this more, I want to redo the organization of mime types in the source so it essentially pairs a list of extensions and a list of MIME types with the "most relevant extension" and "most relevant MIME type" sorted first. The list as a whole should be sorted lexicographically just for sanity reasons. I also think there's a lot of syntactic overhead in the list right now as it's defined in a Rust source file, so instead I think I want to devise a really simple text format for the list. I'm thinking something like this:
|
Gonna +1 this. You might want to check out the mime2ext crate, which allegedly has a better mapping, and the description mentions this crate and this deficiency. |
I think the first result from
mime_guess::get_mime_extensions
should be one of the most common extensions used for a given mime type. Currently, it returns "jpe" for image/jpeg, even though "jpg" and "jpeg" seem to be significantly more common.The text was updated successfully, but these errors were encountered: