aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorMorris Jobke <hey@morrisjobke.de>2014-09-19 21:39:30 +0200
committerMorris Jobke <hey@morrisjobke.de>2014-09-19 21:39:30 +0200
commit463dd44d6d04430420187858c71b80c3928d3d17 (patch)
tree85e719649d3d14e701d6fd3be1951c5b6af645f9 /lib
parentbdcf858eb82bbd69937c22214f1d05915fdb0e67 (diff)
parent6869d2e82aa654f6166b70af37d8ca1510d299ad (diff)
downloadnextcloud-server-463dd44d6d04430420187858c71b80c3928d3d17.tar.gz
nextcloud-server-463dd44d6d04430420187858c71b80c3928d3d17.zip
Merge pull request #11178 from owncloud/throw-error-on-preview-instead-in-the-contructor
Throw error in showPreview instead the constructor
Diffstat (limited to 'lib')
-rwxr-xr-xlib/private/preview.php14
1 files changed, 7 insertions, 7 deletions
diff --git a/lib/private/preview.php b/lib/private/preview.php
index 21fa581d84e..292a8d481fd 100755
--- a/lib/private/preview.php
+++ b/lib/private/preview.php
@@ -111,11 +111,6 @@ class Preview {
\OC_Log::write('core', 'No preview providers exist', \OC_Log::ERROR);
throw new \Exception('No preview providers');
}
-
- // Check if file is valid
- if($this->isFileValid() === false) {
- throw new NotFoundException('File not found.');
- }
}
/**
@@ -540,10 +535,15 @@ class Preview {
}
/**
- * show preview
- * @return void
+ * @param null|string $mimeType
+ * @throws NotFoundException
*/
public function showPreview($mimeType = null) {
+ // Check if file is valid
+ if($this->isFileValid() === false) {
+ throw new NotFoundException('File not found.');
+ }
+
\OCP\Response::enableCaching(3600 * 24); // 24 hours
if (is_null($this->preview)) {
$this->getPreview();