aboutsummaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
Diffstat (limited to 'core')
-rw-r--r--core/ajax/preview.php28
1 files changed, 12 insertions, 16 deletions
diff --git a/core/ajax/preview.php b/core/ajax/preview.php
index 03dfb483062..f7e24e0ec28 100644
--- a/core/ajax/preview.php
+++ b/core/ajax/preview.php
@@ -29,21 +29,17 @@ if ($maxX === 0 || $maxY === 0) {
exit;
}
-try {
- $preview = new \OC\Preview(\OC_User::getUser(), 'files');
- $info = \OC\Files\Filesystem::getFileInfo($file);
- if (!$always and !$preview->isAvailable($info)) {
- \OC_Response::setStatus(404);
- } else {
- $preview->setFile($file);
- $preview->setMaxX($maxX);
- $preview->setMaxY($maxY);
- $preview->setScalingUp($scalingUp);
- $preview->setKeepAspect($keepAspect);
- $preview->showPreview();
- }
+$preview = new \OC\Preview(\OC_User::getUser(), 'files');
-} catch (\Exception $e) {
- \OC_Response::setStatus(500);
- \OC_Log::write('core', $e->getmessage(), \OC_Log::DEBUG);
+$info = \OC\Files\Filesystem::getFileInfo($file);
+
+if (!$info instanceof OCP\Files\FileInfo || !$always && !$preview->isAvailable($info)) {
+ \OC_Response::setStatus(404);
+} else {
+ $preview->setFile($file);
+ $preview->setMaxX($maxX);
+ $preview->setMaxY($maxY);
+ $preview->setScalingUp($scalingUp);
+ $preview->setKeepAspect($keepAspect);
+ $preview->showPreview();
}