Merge pull request #26809 from nextcloud/backport/26647/stable20
[stable20] Fail when creating new files with an empty path
This commit is contained in:
commit
82b93f1cf0
|
@ -190,6 +190,9 @@ class Folder extends Node implements \OCP\Files\Folder {
|
||||||
* @throws \OCP\Files\NotPermittedException
|
* @throws \OCP\Files\NotPermittedException
|
||||||
*/
|
*/
|
||||||
public function newFile($path, $content = null) {
|
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)) {
|
if ($this->checkPermissions(\OCP\Constants::PERMISSION_CREATE)) {
|
||||||
$fullPath = $this->getFullPath($path);
|
$fullPath = $this->getFullPath($path);
|
||||||
$nonExisting = new NonExistingFile($this->root, $this->view, $fullPath);
|
$nonExisting = new NonExistingFile($this->root, $this->view, $fullPath);
|
||||||
|
|
Loading…
Reference in New Issue