From 863aedf784d582a458c8befd709795f2595e3ba6 Mon Sep 17 00:00:00 2001 From: Bjoern Schiessle Date: Thu, 28 Nov 2013 18:59:12 +0100 Subject: [PATCH] detect mimetype from the original filename, without the delete timestamp --- apps/files_trashbin/ajax/preview.php | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/apps/files_trashbin/ajax/preview.php b/apps/files_trashbin/ajax/preview.php index a0846b051c7..945466705c1 100644 --- a/apps/files_trashbin/ajax/preview.php +++ b/apps/files_trashbin/ajax/preview.php @@ -29,8 +29,15 @@ if($maxX === 0 || $maxY === 0) { } try{ - $preview = new \OC\Preview(\OC_User::getUser(), 'files_trashbin/files'); - $preview->setFile($file); + $preview = new \OC\Preview(\OC_User::getUser(), 'files_trashbin/files', $file); + $view = new \OC\Files\View('/'.\OC_User::getUser(). '/files_trashbin/files'); + if ($view->is_dir($file)) { + $mimetype = 'httpd/unix-directory'; + } else { + $mimetype = \OC_Helper::getFileNameMimeType(pathinfo($file, PATHINFO_FILENAME)); + } + $preview->setMimetype($mimetype); + $preview->setMimetype($mimetype); $preview->setMaxX($maxX); $preview->setMaxY($maxY); $preview->setScalingUp($scalingUp); -- 2.39.5