mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
BUGFIX Only use finfo if the file exists, otherwise the MIME type
detection won't work, such as in the case of HTTPRequest::send_file()
This commit is contained in:
parent
e2aa635323
commit
c9bcfd49ec
@ -204,7 +204,7 @@ class HTTP {
|
||||
*/
|
||||
public static function get_mime_type($filename) {
|
||||
// If the finfo module is compiled into PHP, use it.
|
||||
if(class_exists('finfo')) {
|
||||
if(class_exists('finfo') && file_exists($filename)) {
|
||||
$finfo = new finfo(FILEINFO_MIME_TYPE);
|
||||
return $finfo->file(BASE_PATH . DIRECTORY_SEPARATOR . $filename);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user