summaryrefslogtreecommitdiffstats
path: root/lib/private/Preview/Generator.php
diff options
context:
space:
mode:
authorMorris Jobke <hey@morrisjobke.de>2018-05-30 11:34:29 +0200
committerGitHub <noreply@github.com>2018-05-30 11:34:29 +0200
commit3acfcc433a6ce727f0db0fbe7f67780747bc1354 (patch)
tree5bdfcc97233bfc4def12ada82a9408a9f26b1af2 /lib/private/Preview/Generator.php
parentdb5947486866748670995687759447080bc6f0b0 (diff)
parente55effc5efccc94db41e4d1fc8f9dac404a14411 (diff)
downloadnextcloud-server-3acfcc433a6ce727f0db0fbe7f67780747bc1354.tar.gz
nextcloud-server-3acfcc433a6ce727f0db0fbe7f67780747bc1354.zip
Merge pull request #9668 from nextcloud/backport/9666/stable13
[stable13] Make sure the file is readable before attempting to create a preview
Diffstat (limited to 'lib/private/Preview/Generator.php')
-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,[