Skip to content

Commit

Permalink
Merge pull request #1614 from revoltek-daniel/patch-1
Browse files Browse the repository at this point in the history
Check if path is a file in FileSystemLoader
  • Loading branch information
dbu authored Dec 12, 2024
2 parents 98e0318 + 59a78cd commit 6d8dee9
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions Binary/Loader/FileSystemLoader.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
namespace Liip\ImagineBundle\Binary\Loader;

use Liip\ImagineBundle\Binary\Locator\LocatorInterface;
use Liip\ImagineBundle\Exception\Binary\Loader\NotLoadableException;
use Liip\ImagineBundle\Exception\InvalidArgumentException;
use Liip\ImagineBundle\Model\FileBinary;
use Symfony\Component\HttpFoundation\File\MimeType\ExtensionGuesserInterface as DeprecatedExtensionGuesserInterface;
Expand Down Expand Up @@ -69,6 +70,11 @@ public function __construct(
public function find($path)
{
$path = $this->locator->locate($path);

if (\is_file($path) === false) {
throw new NotLoadableException(\sprintf('Source image: "%s" is no file.', $path));
}

$mimeType = $this->mimeTypeGuesser instanceof DeprecatedMimeTypeGuesserInterface ? $this->mimeTypeGuesser->guess($path) : $this->mimeTypeGuesser->guessMimeType($path);
$extension = $this->getExtension($mimeType);

Expand Down

0 comments on commit 6d8dee9

Please sign in to comment.