summaryrefslogtreecommitdiffstats
path: root/lib/private/Preview.php
diff options
context:
space:
mode:
authorRoeland Jago Douma <rullzer@users.noreply.github.com>2016-09-13 19:23:51 +0200
committerGitHub <noreply@github.com>2016-09-13 19:23:51 +0200
commitb6439da1288d629eaf07d3d6f2497f3583fd11e7 (patch)
tree1d7b8c1854dadb1f666983e4deb48202dba47ade /lib/private/Preview.php
parent314dc0ef9172b2765ccd0cae8afe777bec91a13d (diff)
parentf56ae37e8fe31afb109889816273c21704361f15 (diff)
downloadnextcloud-server-b6439da1288d629eaf07d3d6f2497f3583fd11e7.tar.gz
nextcloud-server-b6439da1288d629eaf07d3d6f2497f3583fd11e7.zip
Merge pull request #1338 from nextcloud/fix-trashbin-errors
Opening the trashbin causes errors in log for files without preview
Diffstat (limited to 'lib/private/Preview.php')
-rw-r--r--lib/private/Preview.php6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/private/Preview.php b/lib/private/Preview.php
index 28579ef2c86..ccaec738caf 100644
--- a/lib/private/Preview.php
+++ b/lib/private/Preview.php
@@ -791,6 +791,7 @@ class Preview {
* @param null|string $mimeTypeForHeaders the media type to use when sending back the reply
*
* @throws NotFoundException
+ * @throws PreviewNotAvailableException
*/
public function showPreview($mimeTypeForHeaders = null) {
// Check if file is valid
@@ -1172,6 +1173,7 @@ class Preview {
/**
* Defines the media icon, for the media type of the original file, as the preview
+ * @throws PreviewNotAvailableException
*/
private function getMimeIcon() {
$image = new \OC_Image();
@@ -1181,6 +1183,10 @@ class Preview {
} else {
$mimeIconServerPath = str_replace(\OC::$WEBROOT, \OC::$SERVERROOT, $mimeIconWebPath);
}
+ // we can't load SVGs into an image
+ if (substr($mimeIconWebPath, -4) === '.svg') {
+ throw new PreviewNotAvailableException('SVG mimetype cannot be rendered');
+ }
$image->loadFromFile($mimeIconServerPath);
$this->preview = $image;