[ticket/15276] Use finfo to get mimetype

PHPBB3-15276
This commit is contained in:
Rubén Calvo 2017-08-09 02:42:22 +02:00
parent 400e663347
commit 090ed9bf79

View file

@ -275,6 +275,16 @@ class local implements adapter_interface, stream_interface
*/ */
public function file_mimetype($path) public function file_mimetype($path)
{ {
return mime_content_type($this->root_path . $path); if (class_exists('finfo'))
{
$finfo = new \finfo(FILEINFO_MIME_TYPE);
$mimetype = $finfo->file($this->root_path . $path);
}
else
{
$mimetype = mime_content_type($this->root_path . $path);
}
return $mimetype;
} }
} }