Merge pull request #11178 from owncloud/throw-error-on-preview-instead-in-the-contructor

Throw error in showPreview instead the constructor
This commit is contained in:
Morris Jobke 2014-09-19 21:39:30 +02:00
commit 463dd44d6d

View file

@ -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();