-
Notifications
You must be signed in to change notification settings - Fork 131
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
Add in new public function - lookupAll(). #33
base: master
Are you sure you want to change the base?
Conversation
This finds all MIME types assocaited with a particular file extension.
Any questions about the PR? Or are there any changes I should make for this PR? |
Any chance somebody can take a look at this? It still would be valuable to us if we can merge it in. |
I don't think I saw an email previously; I'll take a look. |
Hi again. Any chance this can be looked at? |
Conflicts over an extension are rarely the result of an actual difference in media types. Rather, they stem from uncertainty over what the mime type string should be. E.g. For v2 of the 'mime' module, I'm taking the stance that extension<->type string mappings should be deterministic and, thus, will be proactively (and arguably arbitrarily) resolving any conflicts as part of the build step in that module. This would make a |
is this ready to be merged? would be very useful! |
Any news on that? For example |
@dougwilson Hey! Any updates on this? |
FWIW, my arguments for why I'm reluctant to support this feature in I'm not 100% against it, but I do question whether there's really enough value here to make it worth the trouble. I'm curious what your take is @dougwilson. [Also, random aside: I notice you've created a "3.0" milestone for this. If you're planning a major release, I'd like to hear what you're planning, and if it might make sense to try to combine the |
It's been so long I barely even remember the context of why I wanted this in the first place. That being said, I wanted to share what I can remember to at least express the motivation better. There may be a better answer than If I remember right, it was something along the lines of attempting to provide validation on the type of file being received. Not so much from a security perspective, but more a usability perspective. An example: if a user is required to upload a CSV file to a site but it's MIME type is It may not be worth the maintenance cost to add this into the API, it's true. So I genuinely don't know the right answer. It seemed like the right move for us at the time though. Hopefully that helps! |
It is more then two years after the last conversation and 6 years after this PR started. I use the lookup to map fileextensions to a mimetype. However, this will fail (sometimes) because I only get the first mimetype and not all mimetypes that are related. Long story short: Is this PR still making any change to bo merged or should I search for an alternative way? |
If anyone still wants a simple reason to support this: file upload filter functionality requires passing in a full set of accepted extensions in most APIs. So, for instance, |
FWIW, I just published the first beta release of |
This is to address #23. The goal of this PR is add a function for looking up all MIME types associated to a file extension.
This would be useful for me to be able to create sets of acceptable MIME types for file validations without having to manually look up each potential MIME type with it. This happens to come up in a few examples (including
bmp
,rtf
, andmp3
to name a few).Hoping to have a conversation about what's good or not. I thought an initial implementation would be a good starting point.
Thanks for your work on this module!