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:
commit
463dd44d6d
1 changed files with 7 additions and 7 deletions
|
@ -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();
|
||||
|
|
Loading…
Reference in a new issue