diff --git a/lib/private/preview.php b/lib/private/preview.php index 21fa581d84..292a8d481f 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();