Hello,
The file MIME type check has a bug in which two errors could be produced. The code shows:
$this->messages['INVALID_MIME_TYPE'] = "$mime_type is not in list of allowable types";
}
$this->messages['FILE_NOT_FOUND'] = "File not found - $file_name";
So an invalid mime type error is recorded, and then the file not found one is recorded too. Basically the 'else' statement is missing from the 'if' statement'. A patch for this is below:
--- library/Xerte/Validate/FileMimeType.php.orig 2015-07-29 23:17:23.000000000 +0100
+++ library/Xerte/Validate/FileMimeType.php 2015-08-19 00:06:15.258614703 +0100
@@ -46,9 +46,12 @@
if(in_array($mime_type, self::$allowableMimeTypeList)) {
return true;
}
+ error_log("Invalid MIME type found in {$file_name}: $mime_type");
$this->messages['INVALID_MIME_TYPE'] = "$mime_type is not in list of allowable types";
}
- $this->messages['FILE_NOT_FOUND'] = "File not found - $file_name";
+ else {
+ $this->messages['FILE_NOT_FOUND'] = "File not found - $file_name";
+ }
}
else {
$this->messages['UNSUPPORTED'] = "Can't run - function: mime_content_type not found";
I included an error_log statement into the patch because I found it useful to log the file name and the mime type when an invalid one was found.
John.