fix: use `wp_check_filetype` to get a mime type if module FINFO not present

This commit is contained in:
vnmedeiros 2022-11-14 11:52:04 -03:00
parent daa0a67aed
commit e842645b5c
2 changed files with 8 additions and 7 deletions

View File

@ -188,7 +188,8 @@ class Media {
finfo_close( $finfo );
return $mime_type;
}
return '';
$filetypes = \wp_check_filetype($filename);
return isset($filetypes['type']) && $filetypes['type'] != false ? $filetypes['type'] : '';
}
/**

View File

@ -13,13 +13,13 @@ class Private_Files {
public $dir_separator;
public static function get_instance() {
if(!isset(self::$instance)) {
self::$instance = new self();
}
public static function get_instance() {
if(!isset(self::$instance)) {
self::$instance = new self();
}
return self::$instance;
}
return self::$instance;
}
protected function __construct() {