Skip to content

Commit

Permalink
fix(common/helper): the mimetype guesser is not good at recognize tex…
Browse files Browse the repository at this point in the history
…t file (#1083)
  • Loading branch information
theus77 authored Nov 28, 2024
1 parent 215393b commit 98dc5c0
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion EMS/common-bundle/src/Helper/MimeTypeHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public static function getInstance(): self
public function guessMimeType(string $filename): string
{
$mimeType = $this->mimeTypes->guessMimeType($filename);
if (self::TEXT_PLAIN === $mimeType) {
if (\str_starts_with($mimeType ?? '', 'text/')) {
$ext = \pathinfo($filename, PATHINFO_EXTENSION);
$mimeType = $this->mimeTypes->getMimeTypes($ext)[0] ?? $mimeType;
}
Expand Down

0 comments on commit 98dc5c0

Please sign in to comment.