diff options
author | Julius Härtl <jus@bitgrid.net> | 2019-05-28 13:05:20 +0200 |
---|---|---|
committer | Backportbot <backportbot-noreply@rullzer.com> | 2019-05-28 13:04:49 +0000 |
commit | 77649792813efcf200298a8dfdf3586eaa04b377 (patch) | |
tree | 8103179b1048aa82bbd17ed95c20e91e4f7230eb /lib | |
parent | 153d9ba9d65732637fa64476ce83e23b7594a787 (diff) | |
download | nextcloud-server-77649792813efcf200298a8dfdf3586eaa04b377.tar.gz nextcloud-server-77649792813efcf200298a8dfdf3586eaa04b377.zip |
Check for free space on touch
Signed-off-by: Julius Härtl <jus@bitgrid.net>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/private/Files/Node/Folder.php | 7 | ||||
-rw-r--r-- | lib/private/Files/Storage/Wrapper/Quota.php | 10 |
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); + } + } |