summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/private/DirectEditing/Manager.php5
1 files changed, 2 insertions, 3 deletions
diff --git a/lib/private/DirectEditing/Manager.php b/lib/private/DirectEditing/Manager.php
index ac85e62cb72..5e3f7755938 100644
--- a/lib/private/DirectEditing/Manager.php
+++ b/lib/private/DirectEditing/Manager.php
@@ -124,10 +124,9 @@ class Manager implements IManager {
public function create(string $path, string $editorId, string $creatorId, $templateId = null): string {
$userFolder = $this->rootFolder->getUserFolder($this->userId);
- try {
- $file = $userFolder->get($path);
+ if ($userFolder->nodeExists($path)) {
throw new \RuntimeException('File already exists');
- } catch (\OCP\Files\NotFoundException $e) {
+ } else {
$file = $userFolder->newFile($path);
$editor = $this->getEditor($editorId);
$creators = $editor->getCreators();