Commit 04ce69d8 authored by Carsten  Rose's avatar Carsten Rose
Browse files

Fixes bug that no mime_type_content is called if there is on file.

parent 060075a6
Pipeline #2758 passed with stages
in 5 minutes and 2 seconds
...@@ -39,7 +39,7 @@ class HelperFile { ...@@ -39,7 +39,7 @@ class HelperFile {
} }
/** /**
* Returns a uniqe (use for temporary) filename, prefixed with QFQ TMP_FILE_PREFIX * Returns a uniq (use for temporary) filename, prefixed with QFQ TMP_FILE_PREFIX
* *
* @return bool|string * @return bool|string
*/ */
......
...@@ -516,6 +516,13 @@ class Download { ...@@ -516,6 +516,13 @@ class Download {
case DOWNLOAD_MODE_EXCEL: case DOWNLOAD_MODE_EXCEL:
$excel = new Excel(); $excel = new Excel();
$filename = $excel->process($tmpFiles, $tmpData); $filename = $excel->process($tmpFiles, $tmpData);
if (empty($filename) || !file_exists($filename)) {
throw new \DownloadException(json_encode(
[ERROR_MESSAGE_TO_USER => 'Newly created Excel file is broken.',
ERROR_MESSAGE_TO_DEVELOPER => "File: '$filename''"]), ERROR_IO_READ_FILE);
}
if (empty($vars[DOWNLOAD_EXPORT_FILENAME])) { if (empty($vars[DOWNLOAD_EXPORT_FILENAME])) {
if (HelperFile::isQfqTemp($filename)) { if (HelperFile::isQfqTemp($filename)) {
$vars[DOWNLOAD_EXPORT_FILENAME] = DOWNLOAD_OUTPUT_FILENAME . ".xlsx"; $vars[DOWNLOAD_EXPORT_FILENAME] = DOWNLOAD_OUTPUT_FILENAME . ".xlsx";
......
Markdown is supported
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