diff options
author | Roeland Jago Douma <roeland@famdouma.nl> | 2018-05-29 21:09:08 +0200 |
---|---|---|
committer | Morris Jobke <hey@morrisjobke.de> | 2018-05-30 11:34:02 +0200 |
commit | 14acded1713c3e0546f1aad7b0d58b0f3a5bd1d7 (patch) | |
tree | f274c0f5760159da2ba7e6bea84241918e96e9dc /lib/private/Preview | |
parent | 182910b13680fe35e3572ac9490a29cfbaf5fb34 (diff) | |
download | nextcloud-server-14acded1713c3e0546f1aad7b0d58b0f3a5bd1d7.tar.gz nextcloud-server-14acded1713c3e0546f1aad7b0d58b0f3a5bd1d7.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 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,[ |