| @@ -135,21 +135,9 @@ | ||
| 135 | 135 | } |
| 136 | 136 | |
| 137 | 137 | private function detectMimeType(string $filePath): string |
| 138 | 138 | { |
| 139 | - $fileType = wp_check_filetype($filePath); | |
| 140 | - if (!empty($fileType['type'])) return (string) $fileType['type']; | |
| 141 | - | |
| 142 | - if (function_exists('finfo_open')) { | |
| 143 | - $finfo = finfo_open(FILEINFO_MIME_TYPE); | |
| 144 | - if ($finfo) { | |
| 145 | - $mimeType = finfo_file($finfo, $filePath); | |
| 146 | - finfo_close($finfo); | |
| 147 | - if (is_string($mimeType) && $mimeType !== '') return $mimeType; | |
| 148 | - } | |
| 149 | - } | |
| 150 | - | |
| 151 | - return 'application/octet-stream'; | |
| 139 | + return MediaMimeType::detect($filePath); | |
| 152 | 140 | } |
| 153 | 141 | |
| 154 | 142 | private function decodeBody($body): array |
| 155 | 143 | { |