Skip to content
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

is there a way to handle different mimetype for same extension #28

Closed
piaoger opened this issue Dec 16, 2017 · 2 comments · Fixed by #48
Closed

is there a way to handle different mimetype for same extension #28

piaoger opened this issue Dec 16, 2017 · 2 comments · Fixed by #48

Comments

@piaoger
Copy link

piaoger commented Dec 16, 2017

there are some extension has two mimetypes, such as:
rtf application/rtf; text/rtf
sh application/x-sh; text/x-sh

do we have a way to handle such a case or can we customize the buiitin mimetypes?

@abonander
Copy link
Owner

abonander commented Dec 16, 2017

It'd be trivial to extend each function to return an array/slice of MIME types instead of a single one.

However, now we have the problem on how to order the types returned, assuming most people are just going to take the first type returned if they only need one. So the first type returned should be the most "correct", but what determines that is going to be inherently arbitrary.

As a rule of thumb I would tend to say whichever type was registered with the IANA first unless the later one explicitly supercedes the former, which means text/rtfwould actually come before application/rtf.

soyuka added a commit to soyuka/mime_guess that referenced this issue Jul 7, 2018
@abonander abonander mentioned this issue Jan 28, 2019
@abonander
Copy link
Owner

The new API I've proposed in this comment will support this: #43 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants