diff options
author | Morris Jobke <hey@morrisjobke.de> | 2018-05-30 12:42:24 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-05-30 12:42:24 +0300 |
commit | a98bfa8d87caebfc2da06527d365f7f0a2f273fa (patch) | |
tree | 31f0b5c83f9b273f60d92db3180ddde11e5df305 /lib | |
parent | 752b5d589b1a264651baada7a2210cd89a01c43f (diff) | |
parent | 8d596461d5a860b5e778e1c5db1543f94d00ded0 (diff) |
Merge pull request #9669 from nextcloud/backport/9666/stable12
[stable12] Make sure the file is readable before attempting to create a preview
Diffstat (limited to 'lib')
-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 db3b4e87f72..14f113a06d0 100644 --- a/lib/private/Preview/Generator.php +++ b/lib/private/Preview/Generator.php @@ -87,6 +87,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,[ |