From 39cbc6e09e382b7cb97c81daa7aca73d50e5e6ff Mon Sep 17 00:00:00 2001 From: Felix Nieuwenhuizen Date: Sat, 26 Jan 2019 17:23:23 +0100 Subject: [PATCH] Fix for issue 10862: calculation of free space ignores external storage (doesn't count towards quota) Signed-off-by: Felix Nieuwenhuizen --- apps/files_trashbin/lib/Trashbin.php | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/apps/files_trashbin/lib/Trashbin.php b/apps/files_trashbin/lib/Trashbin.php index b9a8a42a21..3d43430e6d 100644 --- a/apps/files_trashbin/lib/Trashbin.php +++ b/apps/files_trashbin/lib/Trashbin.php @@ -680,11 +680,10 @@ class Trashbin { // calculate available space for trash bin // subtract size of files and current trash bin size from quota if ($softQuota) { - $userFolder = \OC::$server->getUserFolder($user); - if(is_null($userFolder)) { - return 0; - } - $free = $quota - $userFolder->getSize(); // remaining free space for user + $files_view = new View('/' . $user . '/files'); + $rootInfo = $files_view->getFileInfo('/', false); + $free = $quota - $rootInfo['size']; // remaining free space for user + if ($free > 0) { $availableSpace = ($free * self::DEFAULTMAXSIZE / 100) - $trashbinSize; // how much space can be used for versions } else {