Commit 5783f8c0 authored by Carsten  Rose's avatar Carsten Rose
Browse files

Download.php: references to non existing files now reported as missing file,...

Download.php: references to non existing files now reported as missing file, not 'wrong mimetype' anymore.
parent 0546b3ec
......@@ -248,6 +248,7 @@ const ERROR_DOWNLOAD_NO_FILES = 1701;
const ERROR_DOWNLOAD_NOTHING_TO_DO = 1702;
const ERROR_DOWNLOAD_UNEXPECTED_MIME_TYPE = 1703;
const ERROR_DOWNLOAD_UNEXPECTED_NUMBER_OF_SOURCES = 1704;
const ERROR_DOWNLOAD_FILE_NOT_READABLE = 1705;
// KeyValueParser
const ERROR_KVP_VALUE_HAS_NO_KEY = 1900;
......
......@@ -97,6 +97,13 @@ class Download {
// Remove empty entries. Might happen if there was no upload
$files = OnArray::removeEmptyElementsFromArray($files);
// Check that all files exist and readable
foreach ($files AS $filename) {
if(!is_readable($filename)){
throw new downloadException("Error reading file $filename. Not found or no permission", ERROR_DOWNLOAD_FILE_NOT_READABLE);
}
}
switch (count($files)) {
case 0:
return '';
......
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