diff options
author | Lukas Reschke <lukas@owncloud.com> | 2015-12-14 16:35:16 +0100 |
---|---|---|
committer | Lukas Reschke <lukas@owncloud.com> | 2015-12-14 16:35:16 +0100 |
commit | 5881d7b8ed4642c307b185c50b4a0fe6767c7748 (patch) | |
tree | f59c4f1dd637da2a52ed96493817734284127285 /apps | |
parent | ed9089f951967275b121e4cad3a1e3c466182cc1 (diff) | |
parent | 51c6cd5c6a725b4849d995049163a0b87a9c3a58 (diff) | |
download | nextcloud-server-5881d7b8ed4642c307b185c50b4a0fe6767c7748.tar.gz nextcloud-server-5881d7b8ed4642c307b185c50b4a0fe6767c7748.zip |
Merge pull request #21193 from owncloud/preview-non-existing-81
[8.1] Handle non existing files in version previews
Diffstat (limited to 'apps')
-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 8ad0fe58306..fd7ae967515 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); |