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:
Sean Harvey 2012-05-17 14:53:40 +12:00
parent e2aa635323
commit c9bcfd49ec

View File

@ -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);
}