Skip to content

Commit a6d562d

Browse files
authored
Use MimeTypes guessMimeType for better and more extensible MimeType detection (#3188)
* Use the MimeTypes guessers for Mimetype detection Signed-off-by: Kevin Ullyott <[email protected]> * Fix styling --------- Signed-off-by: Kevin Ullyott <[email protected]>
1 parent c6c4d8c commit a6d562d

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

src/Support/File.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
namespace Spatie\MediaLibrary\Support;
44

5-
use Finfo;
5+
use Symfony\Component\Mime\MimeTypes;
66

77
class File
88
{
@@ -23,8 +23,6 @@ public static function getHumanReadableSize(int $sizeInBytes): string
2323

2424
public static function getMimeType(string $path): string
2525
{
26-
$finfo = new Finfo(FILEINFO_MIME_TYPE);
27-
28-
return $finfo->file($path);
26+
return MimeTypes::getDefault()->guessMimeType($path);
2927
}
3028
}

0 commit comments

Comments
 (0)