diff options
author | Robin Appelman <icewind@owncloud.com> | 2015-12-14 15:59:36 +0100 |
---|---|---|
committer | Robin Appelman <icewind@owncloud.com> | 2015-12-14 16:02:38 +0100 |
commit | 07fb3e329b37c19d9eb6a3a114e00a09f3f2798b (patch) | |
tree | fb8f6a3bbdf043198715d2cc039ed94814426e21 | |
parent | 1d650169804b37b7e9864c8032c67dd48c99d08d (diff) | |
download | nextcloud-server-07fb3e329b37c19d9eb6a3a114e00a09f3f2798b.tar.gz nextcloud-server-07fb3e329b37c19d9eb6a3a114e00a09f3f2798b.zip |
Handle non existing files in version previews
-rw-r--r-- | apps/files_versions/ajax/preview.php | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/apps/files_versions/ajax/preview.php b/apps/files_versions/ajax/preview.php index bd9b7366ab0..105616911cf 100644 --- a/apps/files_versions/ajax/preview.php +++ b/apps/files_versions/ajax/preview.php @@ -31,14 +31,18 @@ if($maxX === 0 || $maxY === 0) { try { list($user, $file) = \OCA\Files_Versions\Storage::getUidAndFilename($file); - $preview = new \OC\Preview($user, 'files_versions', $file.'.v'.$version); - $mimetype = \OC_Helper::getFileNameMimeType($file); - $preview->setMimetype($mimetype); - $preview->setMaxX($maxX); - $preview->setMaxY($maxY); - $preview->setScalingUp($scalingUp); + if (is_null($file)) { + \OC_Response::setStatus(404); + } else { + $preview = new \OC\Preview($user, 'files_versions', $file . '.v' . $version); + $mimetype = \OC_Helper::getFileNameMimeType($file); + $preview->setMimetype($mimetype); + $preview->setMaxX($maxX); + $preview->setMaxY($maxY); + $preview->setScalingUp($scalingUp); - $preview->showPreview(); + $preview->showPreview(); + } }catch(\Exception $e) { \OC_Response::setStatus(500); \OC_Log::write('core', $e->getmessage(), \OC_Log::DEBUG); |