-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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 mime type for rar files #4054
Conversation
This MIME type should indeed be added, however it will likely not fix the issue. The problem reported in #3979 is, that the uploaded file gets assigned the
The underlying problem is that during file uploads the browser determines the media type it sends to the server based on the users setup which might vary strongly. See https://stackoverflow.com/a/26303098 for reference. I think the most useful implementation would be to add a fallback after step 1 (see above) that simply keeps the file extension if an extension was passed and the media type is |
On a side note, if we implement such fallback for uploaded files, the changes from #3956 can be reverted, too. (I think |
Relying on the file extension is not an option for security reasons. This way, we could always upload any file. |
That makes sense. However, the way we currently treat 'application/octet-stream' it will always be uploaded as a |
I would like to throw an exception but I'm afraid that would constitute a breaking change and not be something we could implement until version 5. I agree though that matching to Are there no standards we can reference for handling this? What do other frameworks do? |
I just checked the |
I like this solution, and agree that it would not be a BC.
I don't really know what we can do about this. Let me try to restate it and you can correct me if I'm wrong:
If that's all true, I think we just need to add some docs to note that developers who care about extensions/MIMEs need to handle |
I think these points are true, however I would like to wait for @michalsn to confirm. |
Personally, I feel like the current route is okay. The most common cases are covered. And if you handle upload for some specific files you can always add mime type by yourself so it can be recognized correctly. I'm not sure about removing the I mean this: CodeIgniter4/app/Config/Mimes.php Lines 506 to 526 in 4ea15f8
The change wouldn't be anything big. When we have |
Thanks for clarifying. The current changes in this PR are fine besides the discussion, but will not resolve the linked issue (your comment in the issue itself will likely do though) :-) |
I don't think this would be a BC change. Looking at the current state it's more like a bugfix for me. If we have an extension and the mime-type doesn't match then we shouldn't check anything else and just return Definitely - if we decide to make these changes, they won't be added to this PR. |
Mime issues were resolved in different PRs, but I will merge this too since the proposed mime-type is recommended. |
Add mime type for rar files
Add mime type for rar files
Description
This PR adds yet another mime type for
rar
files.Ref: https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Common_types
Most likely will fix #3979
Checklist: