Skip to content

Commit

Permalink
task: fix csv being detected as text/html by finfo
Browse files Browse the repository at this point in the history
  • Loading branch information
kingjia90 authored Nov 2, 2023
1 parent d2dc42e commit 4a3ae74
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/DataSource/Interpreter/CsvFileInterpreter.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,8 @@ public function fileValid(string $path, bool $originalFilename = false): bool
}
}

$csvMimes = ['text/x-comma-separated-values', 'text/comma-separated-values', 'application/octet-stream', 'application/vnd.ms-excel', 'application/x-csv', 'text/x-csv', 'text/csv', 'application/csv', 'application/excel', 'application/vnd.msexcel', 'text/plain'];
// csv that has html tags might be recognized as text/html
$csvMimes = ['text/html','text/x-comma-separated-values', 'text/comma-separated-values', 'application/octet-stream', 'application/vnd.ms-excel', 'application/x-csv', 'text/x-csv', 'text/csv', 'application/csv', 'application/excel', 'application/vnd.msexcel', 'text/plain'];
$finfo = finfo_open(FILEINFO_MIME_TYPE);
$mime = finfo_file($finfo, $path);
finfo_close($finfo);
Expand Down

0 comments on commit 4a3ae74

Please sign in to comment.