-
-
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
TmpFile must have ext for tsv or more. #1874
Conversation
Hi @yupmin Thanks for your pull request. Could you have a look at the CI, as it's currently failing? |
@GlennM is it right? |
@yupmin please also provide a Test for this. |
@yupmin changes are not needed. You only have to use |
Changes are required. The mime type of my CSV (downloaded automatically by a script) is reported as "text/x-Algol68" (which is not a supported mime type). The delimiter is comma (,). But when I try to import it, the mime type is wrongly guessed because the 'TmpFile' doesn't have any extension. |
@topclaudy just make sure to pass the reader type explicitly: https://laravel-excel.maatwebsite.nl/3.1/imports/basics.html#specifying-a-reader-type |
Still happening (I tried \Maatwebsite\Excel\Excel::CSV). The exception message is "File could not be read". The problem is with the |
Not sure what we can do about that @topclaudy here , as that's a PhpSpreadsheet method. You can better open an issue over there, I think :) |
More details... the error spawns from your ReaderFactory Maatwebsite\Excel\Exceptions\UnreadableFileException {#1844 |
Already reported here PHPOffice/PhpSpreadsheet#429 |
The issue could be solved by accepting the PR for the correct extension in the temp file. |
I'll have another look at it soon. |
PHPOffice/PhpSpreadsheet#429 (comment) phpspreadsheet package should be changed. /src/PhpSpreadsheet/Reader/Csv.php
And laravel-excel package should be changed in this way.
or tsv reader is needed. |
@yupmin we cannot change PhpSpreadsheet code, you'll have to create a PR there. |
This should no longer be an issue with the next release |
@patrickbrouwers is it released yet? And if so, how is it fixed? |
I think this been released in version 3.1.6. A test was added to tests/ExcelTest.php:
|
Requirements
Please take note of our contributing guidelines: https://laravel-excel-docs.dev/docs/3.0/getting-started/contributing
Filling out the template is required. Any pull request that does not include enough information to be reviewed in a timely manner may be closed at the maintainers' discretion.
Mark the following tasks as done:
Description of the Change
Why Should This Be Added?
I am not good at English. Please understand.
I Want to import tsv file 'title.akas.tsv' on imdb sample data
But tsv is processing like csv, so tsv extension file can't passing.
'title.akas.tsv' mime type detected as 'application/octet-stream'. maybe this file contains 'utf-8' chareset string and multi country language.
in 'vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Csv.php', 'canRead' function is incorrent at sometime. 'mime_content_type' in 'canRead' is unsafe.
so. tmpfile must have extension.
Benefits
tsv or csv extension file import is very well.
Possible Drawbacks
It looks absent.
Verification Process
None
Applicable Issues