Merge pull request #26807 from nextcloud/backport/26647/stable19

[stable19] Fail when creating new files with an empty path
This commit is contained in:
Morris Jobke 2021-04-28 20:26:55 +02:00 committed by GitHub
commit 3aabf5eca8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 0 deletions

View File

@ -188,6 +188,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);