Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 59a78cd

Browse files
Check if path is a file in FileSystemLoader
1 parent 98e0318 commit 59a78cd

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

Binary/Loader/FileSystemLoader.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
namespace Liip\ImagineBundle\Binary\Loader;
1313

1414
use Liip\ImagineBundle\Binary\Locator\LocatorInterface;
15+
use Liip\ImagineBundle\Exception\Binary\Loader\NotLoadableException;
1516
use Liip\ImagineBundle\Exception\InvalidArgumentException;
1617
use Liip\ImagineBundle\Model\FileBinary;
1718
use Symfony\Component\HttpFoundation\File\MimeType\ExtensionGuesserInterface as DeprecatedExtensionGuesserInterface;
@@ -69,6 +70,11 @@ public function __construct(
6970
public function find($path)
7071
{
7172
$path = $this->locator->locate($path);
73+
74+
if (\is_file($path) === false) {
75+
throw new NotLoadableException(\sprintf('Source image: "%s" is no file.', $path));
76+
}
77+
7278
$mimeType = $this->mimeTypeGuesser instanceof DeprecatedMimeTypeGuesserInterface ? $this->mimeTypeGuesser->guess($path) : $this->mimeTypeGuesser->guessMimeType($path);
7379
$extension = $this->getExtension($mimeType);
7480

0 commit comments

Comments
 (0)