summaryrefslogtreecommitdiffstats
path: root/lib/private/Files
diff options
context:
space:
mode:
authorMorris Jobke <hey@morrisjobke.de>2020-09-09 17:37:28 +0200
committerGitHub <noreply@github.com>2020-09-09 17:37:28 +0200
commitcd563023dbceede717b22ce559f3efdf92b1da31 (patch)
treeefd42433722acc642b841a026ac8ad8aada9c495 /lib/private/Files
parent22ff60e088379335734bc28f2d1af6e920e204e6 (diff)
parente6fca0a519397ef140947fca2d730535fa9b4070 (diff)
downloadnextcloud-server-cd563023dbceede717b22ce559f3efdf92b1da31.tar.gz
nextcloud-server-cd563023dbceede717b22ce559f3efdf92b1da31.zip
Merge pull request #22657 from nextcloud/bugfix/noid/quota-trash-creation
Check if quota should be applied to path when creating directories
Diffstat (limited to 'lib/private/Files')
-rw-r--r--lib/private/Files/Storage/Wrapper/Quota.php11
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;
}