]> source.dussan.org Git - nextcloud-server.git/commitdiff
Fail when creating new files with an empty path 26809/head
authorJulius Härtl <jus@bitgrid.net>
Tue, 20 Apr 2021 09:20:20 +0000 (11:20 +0200)
committerbackportbot[bot] <backportbot[bot]@users.noreply.github.com>
Wed, 28 Apr 2021 10:06:03 +0000 (10:06 +0000)
Signed-off-by: Julius Härtl <jus@bitgrid.net>
lib/private/Files/Node/Folder.php

index 65854f505429645ea0cb383d40d60500e3b0a029..3a90a35b4940a2b265aba63b8dbd39f0e329eb60 100644 (file)
@@ -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);