[Pkg-owncloud-commits] [owncloud] 69/86: Handle non existing files in version previews
David Prévot
taffit at moszumanska.debian.org
Tue Dec 22 16:52:02 UTC 2015
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to annotated tag v8.1.5
in repository owncloud.
commit 51c6cd5c6a725b4849d995049163a0b87a9c3a58
Author: Robin Appelman <icewind at owncloud.com>
Date: Mon Dec 14 15:59:36 2015 +0100
Handle non existing files in version previews
---
apps/files_versions/ajax/preview.php | 18 +++++++++++-------
1 file changed, 11 insertions(+), 7 deletions(-)
diff --git a/apps/files_versions/ajax/preview.php b/apps/files_versions/ajax/preview.php
index 8ad0fe5..fd7ae96 100644
--- a/apps/files_versions/ajax/preview.php
+++ b/apps/files_versions/ajax/preview.php
@@ -45,14 +45,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);
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud.git
More information about the Pkg-owncloud-commits
mailing list