Fail when creating new files with an empty path

Signed-off-by: Julius Härtl <jus@bitgrid.net>
This commit is contained in:
Julius Härtl 2021-04-20 11:20:20 +02:00 committed by backportbot[bot]
parent b5574db974
commit 4f8c89f8a5
1 changed files with 3 additions and 0 deletions

View 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);