Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorJulius Härtl <jus@bitgrid.net>2021-04-20 12:20:20 +0300
committerJulius Härtl <jus@bitgrid.net>2021-04-20 12:20:20 +0300
commit8398762d78c84119b08c533da39d3d4ac69380d7 (patch)
tree24b7c71eeb20c849cf8c576caa839b32b6c129e2 /lib
parent8ef920fdf90bc54d6f17134ebd80a71db2f9d8ea (diff)
Fail when creating new files with an empty path
Signed-off-by: Julius Härtl <jus@bitgrid.net>
Diffstat (limited to 'lib')
-rw-r--r--lib/private/Files/Node/Folder.php3
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/private/Files/Node/Folder.php b/lib/private/Files/Node/Folder.php
index 7b1eff47cd5..14b663d4e16 100644
--- a/lib/private/Files/Node/Folder.php
+++ b/lib/private/Files/Node/Folder.php
@@ -190,6 +190,9 @@ class Folder extends Node implements \OCP\Files\Folder {
* @throws \OCP\Files\NotPermittedException
*/
public function newFile($path, $content = null) {
+ if (empty($path)) {
+ throw new NotPermittedException('Could not create as provided path is empty');
+ }
if ($this->checkPermissions(\OCP\Constants::PERMISSION_CREATE)) {
$fullPath = $this->getFullPath($path);
$nonExisting = new NonExistingFile($this->root, $this->view, $fullPath);