[HttpFoundation] added an exception to MimeTypeGuesser::guess() when no guesser are available (closes #2636)
This commit is contained in:
parent
0462a89562
commit
d67fbe9e48
@ -110,16 +110,14 @@ class MimeTypeGuesser implements MimeTypeGuesserInterface
|
|||||||
throw new AccessDeniedException($path);
|
throw new AccessDeniedException($path);
|
||||||
}
|
}
|
||||||
|
|
||||||
$mimeType = null;
|
if (!$this->guessers) {
|
||||||
|
throw new \LogicException('Unable to guess the mime type as no guesser are available.');
|
||||||
foreach ($this->guessers as $guesser) {
|
|
||||||
$mimeType = $guesser->guess($path);
|
|
||||||
|
|
||||||
if (null !== $mimeType) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return $mimeType;
|
foreach ($this->guessers as $guesser) {
|
||||||
|
if (null !== $mimeType = $guesser->guess($path)) {
|
||||||
|
return $mimeType;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user