diff --git a/apps/files/index.php b/apps/files/index.php index 7d25c816eb..b8ff08c1b0 100644 --- a/apps/files/index.php +++ b/apps/files/index.php @@ -39,7 +39,7 @@ OCP\App::setActiveNavigationEntry('files_index'); // Load the files $dir = isset($_GET['dir']) ? stripslashes($_GET['dir']) : ''; $dir = \OC\Files\Filesystem::normalizePath($dir); -$dirInfo = \OC\Files\Filesystem::getFileInfo($dir); +$dirInfo = \OC\Files\Filesystem::getFileInfo($dir, false); // Redirect if directory does not exist if (!$dirInfo || !$dirInfo->getType() === 'dir') { header('Location: ' . OCP\Util::getScriptName() . ''); @@ -70,7 +70,7 @@ $config = \OC::$server->getConfig(); $permissions = $dirInfo->getPermissions(); // information about storage capacities -$storageInfo=OC_Helper::getStorageInfo($dir); +$storageInfo=OC_Helper::getStorageInfo($dir, $dirInfo); $freeSpace=$storageInfo['free']; $uploadLimit=OCP\Util::uploadLimit(); $maxUploadFilesize=OCP\Util::maxUploadFilesize($dir, $freeSpace); diff --git a/lib/private/helper.php b/lib/private/helper.php index d7ac0b5f4f..da3d3cd1c6 100644 --- a/lib/private/helper.php +++ b/lib/private/helper.php @@ -875,12 +875,15 @@ class OC_Helper { * Calculate the disc space for the given path * * @param string $path + * @param \OCP\Files\FileInfo $rootInfo (optional) * @return array */ - public static function getStorageInfo($path) { + public static function getStorageInfo($path, $rootInfo = null) { // return storage info without adding mount points - $rootInfo = \OC\Files\Filesystem::getFileInfo($path, false); - $used = $rootInfo['size']; + if (is_null($rootInfo)) { + $rootInfo = \OC\Files\Filesystem::getFileInfo($path, false); + } + $used = $rootInfo->getSize(); if ($used < 0) { $used = 0; }