diff --git a/apps/files_versions/lib/Storage.php b/apps/files_versions/lib/Storage.php index e2e4888cbcef5e95e677a6412c285a352fe7d9b8..c09633be3c11d5cae2e07ee1a87c24e01cb693b5 100644 --- a/apps/files_versions/lib/Storage.php +++ b/apps/files_versions/lib/Storage.php @@ -750,13 +750,16 @@ class Storage { // subtract size of files and current versions size from quota if ($quota >= 0) { if ($softQuota) { - $files_view = new View('/' . $uid . '/files'); - $rootInfo = $files_view->getFileInfo('/', false); - $free = $quota - $rootInfo['size']; // remaining free space for user - if ($free > 0) { - $availableSpace = ($free * self::DEFAULTMAXSIZE / 100) - $versionsSize; // how much space can be used for versions + $userFolder = \OC::$server->getUserFolder($uid); + if(is_null($userFolder)) { + $availableSpace = 0; } else { - $availableSpace = $free - $versionsSize; + $free = $quota - $userFolder->getSize(false); // remaining free space for user + if ($free > 0) { + $availableSpace = ($free * self::DEFAULTMAXSIZE / 100) - $versionsSize; // how much space can be used for versions + } else { + $availableSpace = $free - $versionsSize; + } } } else { $availableSpace = $quota;