diff options
author | Julius Härtl <jus@bitgrid.net> | 2020-09-08 07:33:54 +0200 |
---|---|---|
committer | Julius Härtl <jus@bitgrid.net> | 2020-09-08 07:33:57 +0200 |
commit | 87e5fd0d2c46c1a97050309d37864d0acb5aa8d0 (patch) | |
tree | bfb9c34f1002352e94c065363924298660cc03c5 /lib/private | |
parent | 47e7257c80535a3518168b3a0ccd80ad9fc91d58 (diff) | |
download | nextcloud-server-87e5fd0d2c46c1a97050309d37864d0acb5aa8d0.tar.gz nextcloud-server-87e5fd0d2c46c1a97050309d37864d0acb5aa8d0.zip |
Check if quota should be applied to path when creating directories
This fixes an issue where the files_trashbin hierarchy of a user could
not been created as the mkdir operations were blocked by the quota
storage wrapper. Even with 0 quota, users should be able to have a
trashbin for external storages.
Signed-off-by: Julius Härtl <jus@bitgrid.net>
Diffstat (limited to 'lib/private')
-rw-r--r-- | lib/private/Files/Storage/Wrapper/Quota.php | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/lib/private/Files/Storage/Wrapper/Quota.php b/lib/private/Files/Storage/Wrapper/Quota.php index 62d3335987c..4b99af46b02 100644 --- a/lib/private/Files/Storage/Wrapper/Quota.php +++ b/lib/private/Files/Storage/Wrapper/Quota.php @@ -161,7 +161,7 @@ class Quota extends Wrapper { $free = $this->free_space($path); if ($source && $free >= 0 && $mode !== 'r' && $mode !== 'rb') { // only apply quota for files, not metadata, trash or others - if (strpos(ltrim($path, '/'), 'files/') === 0) { + if ($this->shouldApplyQuota($path)) { return \OC\Files\Stream\Quota::wrap($source, $free); } } @@ -183,6 +183,13 @@ class Quota extends Wrapper { } /** + * Only apply quota for files, not metadata, trash or others + */ + private function shouldApplyQuota(string $path): bool { + return strpos(ltrim($path, '/'), 'files/') === 0; + } + + /** * @param IStorage $sourceStorage * @param string $sourceInternalPath * @param string $targetInternalPath @@ -214,7 +221,7 @@ class Quota extends Wrapper { public function mkdir($path) { $free = $this->free_space($path); - if ($free === 0.0) { + if ($this->shouldApplyQuota($path) && $free === 0.0) { return false; } |