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

Bug: RAR file detected as CSV #3979

Closed
wiedhodho opened this issue Dec 10, 2020 · 8 comments · Fixed by #4054 or #4085
Closed

Bug: RAR file detected as CSV #3979

wiedhodho opened this issue Dec 10, 2020 · 8 comments · Fixed by #4054 or #4085
Labels
bug Verified issues on the current code behavior or pull requests that will fix them

Comments

@wiedhodho
Copy link

I've tried to upload an rar file, and use validation ext_in[rar]

It always fail.

When i tried to check, the system always detect to csv (application/octet-stream) not as a rar file.

@wiedhodho wiedhodho added the bug Verified issues on the current code behavior or pull requests that will fix them label Dec 10, 2020
@sfadschm
Copy link
Contributor

This is the same as #3921, just for another file extension. From the web, it seems that almost every file type can have the binary file type application/octet-stream.
So I wonder if it makes sense to batch add this type to all extensions instead of fixing each one on their own bug report.

@InsiteFX
Copy link
Contributor

I think that all they need to do is add the mime types to the Mimes.php file.

@sfadschm
Copy link
Contributor

Correct. The question is whether this should be done in the repo here to prevent future bug reports for such errors or if the user should add the MIME types themselves, as Mime.php is in the App config anyways.

@InsiteFX
Copy link
Contributor

That is the way we always did it in CodeIgniter 3, we just added it to Mimes.php
Then when a new version of CodeIgniter came out they usually added it to Mimes.php

@sfadschm
Copy link
Contributor

Î'm thinking that rather than adding the application/octet-stream to each and every single file extension, it would maybe be useful to have the guesser rely on the passed file extension alone (if any is given) and not check whether application/octet-stream is listed in the extensions MIME types. Not sure if this would mean some security risk though.

@michalsn
Copy link
Member

michalsn commented Jan 2, 2021

The application/octet-stream is used when there is no other way to handle the file. I would rather try adding application/vnd.rar mime type to the rar array.

@michalsn
Copy link
Member

michalsn commented Jan 2, 2021

Sadly, I can't verify returning application/octet-stream for rar file on Linux or Windows platform.

I would check if the PHP fileinfo extension is enabled because the lack of this extension may be also the reason.

@sfadschm
Copy link
Contributor

sfadschm commented Jan 8, 2021

@wiedhodho can you please check if the changes in #4085 solve your issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Verified issues on the current code behavior or pull requests that will fix them
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants