From 14acded1713c3e0546f1aad7b0d58b0f3a5bd1d7 Mon Sep 17 00:00:00 2001 From: Roeland Jago Douma Date: Tue, 29 May 2018 21:09:08 +0200 Subject: Make sure the file is readable before attempting to create a preview Signed-off-by: Roeland Jago Douma --- lib/private/Preview/Generator.php | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'lib/private/Preview') diff --git a/lib/private/Preview/Generator.php b/lib/private/Preview/Generator.php index 08f6b604eca..3e81004c8aa 100644 --- a/lib/private/Preview/Generator.php +++ b/lib/private/Preview/Generator.php @@ -89,6 +89,12 @@ class Generator { * @throws \InvalidArgumentException if the preview would be invalid (in case the original image is invalid) */ public function getPreview(File $file, $width = -1, $height = -1, $crop = false, $mode = IPreview::MODE_FILL, $mimeType = null) { + //Make sure that we can read the file + if (!$file->isReadable()) { + throw new NotFoundException('Cannot read file'); + } + + $this->eventDispatcher->dispatch( IPreview::EVENT, new GenericEvent($file,[ -- cgit v1.2.3