From a174ba5a36cff8fa2230a0c10c849ddcdb71ded4 Mon Sep 17 00:00:00 2001 From: Bjoern Schiessle Date: Mon, 21 Sep 2015 11:41:26 +0200 Subject: make sure to add the correct file size to the file info, otherwise we will not show the preview for every filetype --- apps/files_trashbin/lib/helper.php | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'apps/files_trashbin/lib') diff --git a/apps/files_trashbin/lib/helper.php b/apps/files_trashbin/lib/helper.php index f51185712a9..0baa2b5414b 100644 --- a/apps/files_trashbin/lib/helper.php +++ b/apps/files_trashbin/lib/helper.php @@ -65,11 +65,14 @@ class Helper if (!\OC\Files\Filesystem::isIgnoredDir($entryName)) { $id = $entryName; if ($dir === '' || $dir === '/') { + $size = $view->filesize($id); $pathparts = pathinfo($entryName); $timestamp = substr($pathparts['extension'], 1); $id = $pathparts['filename']; + } else if ($timestamp === null) { // for subfolders we need to calculate the timestamp only once + $size = $view->filesize($dir . '/' . $id); $parts = explode('/', ltrim($dir, '/')); $timestamp = substr(pathinfo($parts[0], PATHINFO_EXTENSION), 1); } @@ -86,6 +89,7 @@ class Helper 'mimetype' => $view->is_dir($dir . '/' . $entryName) ? 'httpd/unix-directory' : \OC_Helper::getFileNameMimeType($id), 'type' => $view->is_dir($dir . '/' . $entryName) ? 'dir' : 'file', 'directory' => ($dir === '/') ? '' : $dir, + 'size' => $size, ); if ($originalPath) { $i['extraData'] = $originalPath.'/'.$id; -- cgit v1.2.3