aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorMorris Jobke <hey@morrisjobke.de>2019-05-28 15:02:51 +0200
committerGitHub <noreply@github.com>2019-05-28 15:02:51 +0200
commitabeea8b0b96a21a1d1d214fb789c4fbccf98adc5 (patch)
treebdc63ad585fc62efa9b9da259026bbe5961f979e /lib
parent64fb083dd9b4ed271130831273dae180e3e40802 (diff)
parent67dd4b018abde6523c283738411590cf85f5308d (diff)
downloadnextcloud-server-abeea8b0b96a21a1d1d214fb789c4fbccf98adc5.tar.gz
nextcloud-server-abeea8b0b96a21a1d1d214fb789c4fbccf98adc5.zip
Merge pull request #15766 from nextcloud/bugfix/0b-quota-create-backend
Check for free space on touch
Diffstat (limited to 'lib')
-rw-r--r--lib/private/Files/Node/Folder.php7
-rw-r--r--lib/private/Files/Storage/Wrapper/Quota.php10
2 files changed, 14 insertions, 3 deletions
diff --git a/lib/private/Files/Node/Folder.php b/lib/private/Files/Node/Folder.php
index ebf67e47a21..1e9088a7c19 100644
--- a/lib/private/Files/Node/Folder.php
+++ b/lib/private/Files/Node/Folder.php
@@ -181,14 +181,15 @@ class Folder extends Node implements \OCP\Files\Folder {
$nonExisting = new NonExistingFile($this->root, $this->view, $fullPath);
$this->root->emit('\OC\Files', 'preWrite', array($nonExisting));
$this->root->emit('\OC\Files', 'preCreate', array($nonExisting));
- $this->view->touch($fullPath);
+ if (!$this->view->touch($fullPath)) {
+ throw new NotPermittedException('Could not create path');
+ }
$node = new File($this->root, $this->view, $fullPath);
$this->root->emit('\OC\Files', 'postWrite', array($node));
$this->root->emit('\OC\Files', 'postCreate', array($node));
return $node;
- } else {
- throw new NotPermittedException('No create permission for path');
}
+ throw new NotPermittedException('No create permission for path');
}
/**
diff --git a/lib/private/Files/Storage/Wrapper/Quota.php b/lib/private/Files/Storage/Wrapper/Quota.php
index 4cbe9189593..492b5aba436 100644
--- a/lib/private/Files/Storage/Wrapper/Quota.php
+++ b/lib/private/Files/Storage/Wrapper/Quota.php
@@ -209,4 +209,14 @@ class Quota extends Wrapper {
return parent::mkdir($path);
}
+
+ public function touch($path, $mtime = null) {
+ $free = $this->free_space($path);
+ if ($free === 0.0) {
+ return false;
+ }
+
+ return parent::touch($path, $mtime);
+ }
+
}