summaryrefslogtreecommitdiffstats
path: root/lib/private/Preview
diff options
context:
space:
mode:
authorRoeland Jago Douma <roeland@famdouma.nl>2018-05-29 21:09:08 +0200
committerRoeland Jago Douma <roeland@famdouma.nl>2018-05-29 22:03:43 +0200
commite55effc5efccc94db41e4d1fc8f9dac404a14411 (patch)
tree9c32e27b16a5646c201b6e06994ab5e4f26047a3 /lib/private/Preview
parentb71c90bac1cc5367bee3dfd067f2f28372253256 (diff)
downloadnextcloud-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.php6
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,[