From 40560ca98d0f390e417ec8b2f102af0494711dc0 Mon Sep 17 00:00:00 2001 From: Ardinis Date: Sun, 16 Apr 2017 02:32:14 +0200 Subject: [PATCH 1/2] Correctly calculate used space for quota with external storage issue #4348 Signed-off-by: Morris Jobke --- lib/private/legacy/helper.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/private/legacy/helper.php b/lib/private/legacy/helper.php index 9c4bc895fb..6775fe99dc 100644 --- a/lib/private/legacy/helper.php +++ b/lib/private/legacy/helper.php @@ -537,7 +537,7 @@ class OC_Helper { $includeExtStorage = \OC::$server->getSystemConfig()->getValue('quota_include_external_storage', false); if (!$rootInfo) { - $rootInfo = \OC\Files\Filesystem::getFileInfo($path, false); + $rootInfo = \OC\Files\Filesystem::getFileInfo($path, $includeExtStorage ? 'ext' : false); } if (!$rootInfo instanceof \OCP\Files\FileInfo) { throw new \OCP\Files\NotFoundException(); From 51c55a867d78e3d6518d38ab2d5d15f1f2eb65cc Mon Sep 17 00:00:00 2001 From: Morris Jobke Date: Thu, 11 May 2017 11:35:48 -0500 Subject: [PATCH 2/2] fix quota tests for external storage Signed-off-by: Morris Jobke --- tests/lib/HelperStorageTest.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/lib/HelperStorageTest.php b/tests/lib/HelperStorageTest.php index e27d5eca21..d42c43c5ab 100644 --- a/tests/lib/HelperStorageTest.php +++ b/tests/lib/HelperStorageTest.php @@ -158,9 +158,9 @@ class HelperStorageTest extends \Test\TestCase { $config->setSystemValue('quota_include_external_storage', 'true'); $storageInfo = \OC_Helper::getStorageInfo(''); - $this->assertEquals(12, $storageInfo['free']); - $this->assertEquals(5, $storageInfo['used']); - $this->assertEquals(17, $storageInfo['total']); + $this->assertEquals(12, $storageInfo['free'], '12 bytes free in home storage'); + $this->assertEquals(22, $storageInfo['used'], '5 bytes of home storage and 17 bytes of the temporary storage are used'); + $this->assertEquals(34, $storageInfo['total'], '5 bytes used and 12 bytes free in home storage as well as 17 bytes used in temporary storage'); $config->setSystemValue('quota_include_external_storage', $oldConfig); }