diff options
author | Robin Appelman <robin@icewind.nl> | 2017-05-01 14:03:00 +0200 |
---|---|---|
committer | Robin Appelman <robin@icewind.nl> | 2017-05-02 13:43:47 +0200 |
commit | 4dfd90abc423ae34add34a2293c24de8b398246c (patch) | |
tree | 19a37c841dc6220e3cab8058f14645e9abc81e97 /lib/private/Preview | |
parent | 18b5e2fced13f0e7a00910029eeaad60ca8c78e6 (diff) | |
download | nextcloud-server-4dfd90abc423ae34add34a2293c24de8b398246c.tar.gz nextcloud-server-4dfd90abc423ae34add34a2293c24de8b398246c.zip |
better handling of preview generation errors
Signed-off-by: Robin Appelman <robin@icewind.nl>
Diffstat (limited to 'lib/private/Preview')
-rw-r--r-- | lib/private/Preview/Generator.php | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/private/Preview/Generator.php b/lib/private/Preview/Generator.php index fd75e51b638..0fb284259aa 100644 --- a/lib/private/Preview/Generator.php +++ b/lib/private/Preview/Generator.php @@ -303,6 +303,10 @@ class Generator { private function generatePreview(ISimpleFolder $previewFolder, ISimpleFile $maxPreview, $width, $height, $crop, $maxWidth, $maxHeight) { $preview = $this->helper->getImage($maxPreview); + if (!$preview->valid()) { + throw new \InvalidArgumentException('Failed to generate preview, failed to load image'); + } + if ($crop) { if ($height !== $preview->height() && $width !== $preview->width()) { //Resize @@ -325,6 +329,7 @@ class Generator { $preview->resize(max($width, $height)); } + $path = $this->generatePath($width, $height, $crop); try { $file = $previewFolder->newFile($path); |