From 4c4c0fa12066b9dace5d9689836fe4a70141a2d9 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Wed, 11 Mar 2015 17:08:25 +0100 Subject: Use the PreviewManager where possible --- core/ajax/preview.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'core/ajax') diff --git a/core/ajax/preview.php b/core/ajax/preview.php index f7e24e0ec28..12bc80e4037 100644 --- a/core/ajax/preview.php +++ b/core/ajax/preview.php @@ -29,13 +29,12 @@ if ($maxX === 0 || $maxY === 0) { exit; } -$preview = new \OC\Preview(\OC_User::getUser(), 'files'); - $info = \OC\Files\Filesystem::getFileInfo($file); -if (!$info instanceof OCP\Files\FileInfo || !$always && !$preview->isAvailable($info)) { +if (!$info instanceof OCP\Files\FileInfo || !$always && !\OC::$server->getPreviewManager()->isAvailable($info)) { \OC_Response::setStatus(404); } else { + $preview = new \OC\Preview(\OC_User::getUser(), 'files'); $preview->setFile($file); $preview->setMaxX($maxX); $preview->setMaxY($maxY); -- cgit v1.2.3