From 4f8c89f8a5bc991ace6ea25618a58b05c76df4a5 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Julius=20H=C3=A4rtl?= Date: Tue, 20 Apr 2021 11:20:20 +0200 Subject: [PATCH] Fail when creating new files with an empty path MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Julius Härtl --- lib/private/Files/Node/Folder.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/private/Files/Node/Folder.php b/lib/private/Files/Node/Folder.php index 65854f50542..3a90a35b494 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); -- 2.39.5