Commit 76c5b86a authored by Carsten  Rose's avatar Carsten Rose
Browse files

Change getMimeType() in Report in case file is missing or `file` beaks:...

Change getMimeType() in Report in case file is missing or `file` beaks: instead to throw an exception, an empty string is returned.
parent 496601c7
......@@ -64,11 +64,16 @@ class HelperFile {
* @return string
* @throws UserFormException
*/
public static function getMimeType($pathFilename) {
public static function getMimeType($pathFilename, $flagIgnoreError = false) {
// E.g.: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet; charset=binary'
$fileMimeType = exec('file --brief --mime ' . $pathFilename, $output, $return_var);
if ($return_var != 0) {
if ($flagIgnoreError) {
return '';
}
throw new UserFormException('Error get mime type of upload.', ERROR_UPLOAD_GET_MIME_TYPE);
}
......
......@@ -733,7 +733,7 @@ class Report {
break;
case COLUMN_MIME_TYPE:
$content .= HelperFile::getMimeType($columnValue);
$content .= HelperFile::getMimeType($columnValue, true);
break;
case COLUMN_FILE_SIZE:
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment