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

Calculate priority from MIME types of same family #132

Merged

Conversation

janko
Copy link
Contributor

@janko janko commented Feb 25, 2018

Some MIME types are in the same family, but their #simplified values aren't the same. One such example are "text/comma-separated-values" and "text/csv" MIME types. The former is obsolete and unregistered, while the latter is not obsolete and registered, but mime-types would still rank "text/comma-separated-values" higher because it just looks at the alphabetic order.

We check whether MIME types are belong to the same family by checking whether they have common extensions.

Fixes #131.

Some MIME types are in the same family, but their #simplified values
aren't the same. One such example are "text/comma-separated-values" and
"text/csv" MIME types. The former is obsolete and unregistered, while
the latter is not obsolete and registered, but mime-types would still
rank "text/comma-separated-values" higher because it just looks at the
alphabetic order.
@halostatue
Copy link
Member

This looks like a clean interim solution, but I’m not sure if it’s the correct solution. Let me think on this for a day or so.

@janko
Copy link
Contributor Author

janko commented Mar 11, 2018

@halostatue Have you maybe decided about this one?

@halostatue
Copy link
Member

I’m going to merge this. I worry that the & operator will be fairly expensive for this call. I think I’m going to need to do some rethink on some of this for future versions. It feels like a lot of these could be pre-computed into some sort of common value that would make comparison much easier.

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 this pull request may close these issues.

2 participants