diff options
-rw-r--r-- | lib/private/Files/Storage/Wrapper/Quota.php | 3 | ||||
-rw-r--r-- | tests/lib/Files/Storage/Wrapper/QuotaTest.php | 4 |
2 files changed, 5 insertions, 2 deletions
diff --git a/lib/private/Files/Storage/Wrapper/Quota.php b/lib/private/Files/Storage/Wrapper/Quota.php index 3be77ba1b37..d90d84d53f3 100644 --- a/lib/private/Files/Storage/Wrapper/Quota.php +++ b/lib/private/Files/Storage/Wrapper/Quota.php @@ -11,6 +11,7 @@ use OC\Files\Filesystem; use OC\SystemConfig; use OCP\Files\Cache\ICacheEntry; use OCP\Files\FileInfo; +use OCP\Files\NotEnoughSpaceException; use OCP\Files\Storage\IStorage; class Quota extends Wrapper { @@ -180,7 +181,7 @@ class Quota extends Wrapper { } $free = $this->free_space($path); if ($this->shouldApplyQuota($path) && $free == 0) { - return false; + throw new NotEnoughSpaceException('Unable to create directory (' . $path . '): not enough free space'); } return parent::mkdir($path); diff --git a/tests/lib/Files/Storage/Wrapper/QuotaTest.php b/tests/lib/Files/Storage/Wrapper/QuotaTest.php index f07e6021e4e..22703785c47 100644 --- a/tests/lib/Files/Storage/Wrapper/QuotaTest.php +++ b/tests/lib/Files/Storage/Wrapper/QuotaTest.php @@ -10,6 +10,7 @@ namespace Test\Files\Storage\Wrapper; //ensure the constants are loaded use OC\Files\Cache\CacheEntry; use OC\Files\Storage\Local; +use OCP\Files\NotEnoughSpaceException; \OC::$loader->load('\OC\Files\Filesystem'); @@ -211,7 +212,8 @@ class QuotaTest extends \Test\Files\Storage\Storage { public function testNoMkdirQuotaZero(): void { $instance = $this->getLimitedStorage(0.0); $this->assertFalse($instance->mkdir('files')); - $this->assertFalse($instance->mkdir('files/foobar')); + $this->expectException(NotEnoughSpaceException::class); + $instance->mkdir('files/foobar'); } public function testMkdirQuotaZeroTrashbin(): void { |