summaryrefslogtreecommitdiffstats
path: root/lib/private/DirectEditing/Manager.php
diff options
context:
space:
mode:
Diffstat (limited to 'lib/private/DirectEditing/Manager.php')
-rw-r--r--lib/private/DirectEditing/Manager.php8
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/private/DirectEditing/Manager.php b/lib/private/DirectEditing/Manager.php
index 0e7e988eef2..1ea09e74d59 100644
--- a/lib/private/DirectEditing/Manager.php
+++ b/lib/private/DirectEditing/Manager.php
@@ -27,6 +27,7 @@
namespace OC\DirectEditing;
use Doctrine\DBAL\FetchMode;
+use OC\Files\Node\Folder;
use OCP\AppFramework\Http\NotFoundResponse;
use OCP\AppFramework\Http\Response;
use OCP\AppFramework\Http\TemplateResponse;
@@ -130,7 +131,12 @@ class Manager implements IManager {
if ($userFolder->nodeExists($path)) {
throw new \RuntimeException('File already exists');
} else {
- $file = $userFolder->newFile($path);
+ if (!$userFolder->nodeExists(dirname($path))) {
+ throw new \RuntimeException('Invalid path');
+ }
+ /** @var Folder $folder */
+ $folder = $userFolder->get(dirname($path));
+ $file = $folder->newFile(basename($path));
$editor = $this->getEditor($editorId);
$creators = $editor->getCreators();
foreach ($creators as $creator) {