Skip to content

Commit

Permalink
Use MimeTypes guessMimeType for better and more extensible MimeType d…
Browse files Browse the repository at this point in the history
…etection (#3188)

* Use the MimeTypes guessers for Mimetype detection

Signed-off-by: Kevin Ullyott <[email protected]>

* Fix styling

---------

Signed-off-by: Kevin Ullyott <[email protected]>
  • Loading branch information
Orrison authored Feb 17, 2023
1 parent c6c4d8c commit a6d562d
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/Support/File.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace Spatie\MediaLibrary\Support;

use Finfo;
use Symfony\Component\Mime\MimeTypes;

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

public static function getMimeType(string $path): string
{
$finfo = new Finfo(FILEINFO_MIME_TYPE);

return $finfo->file($path);
return MimeTypes::getDefault()->guessMimeType($path);
}
}

0 comments on commit a6d562d

Please sign in to comment.