diff options
author | Roeland Jago Douma <roeland@famdouma.nl> | 2018-05-29 21:09:08 +0200 |
---|---|---|
committer | Roeland Jago Douma <roeland@famdouma.nl> | 2018-05-29 22:03:43 +0200 |
commit | e55effc5efccc94db41e4d1fc8f9dac404a14411 (patch) | |
tree | 9c32e27b16a5646c201b6e06994ab5e4f26047a3 /lib/private/Preview | |
parent | b71c90bac1cc5367bee3dfd067f2f28372253256 (diff) | |
download | nextcloud-server-e55effc5efccc94db41e4d1fc8f9dac404a14411.tar.gz nextcloud-server-e55effc5efccc94db41e4d1fc8f9dac404a14411.zip |
Make sure the file is readable before attempting to create a preview
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
Diffstat (limited to 'lib/private/Preview')
-rw-r--r-- | lib/private/Preview/Generator.php | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/private/Preview/Generator.php b/lib/private/Preview/Generator.php index e28e436b1a0..877d8dd1f8a 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,[ |