diff options
author | Julius Härtl <jus@bitgrid.net> | 2021-03-31 16:21:40 +0200 |
---|---|---|
committer | backportbot[bot] <backportbot[bot]@users.noreply.github.com> | 2021-04-01 13:31:55 +0000 |
commit | dc8e819915acc045bcbc67df098231db30ffb240 (patch) | |
tree | 915c3e034be36fff3c3544cac6df7cc38f8123d4 /lib/private | |
parent | 89a19a338e74a7886aac6edb8bddd1fa020b110c (diff) | |
download | nextcloud-server-dc8e819915acc045bcbc67df098231db30ffb240.tar.gz nextcloud-server-dc8e819915acc045bcbc67df098231db30ffb240.zip |
Properly handle creating the template directory in a subfolder (fixes #25787)
Signed-off-by: Julius Härtl <jus@bitgrid.net>
Diffstat (limited to 'lib/private')
-rw-r--r-- | lib/private/Files/Template/TemplateManager.php | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/private/Files/Template/TemplateManager.php b/lib/private/Files/Template/TemplateManager.php index a81851b2757..3dd7f82bff3 100644 --- a/lib/private/Files/Template/TemplateManager.php +++ b/lib/private/Files/Template/TemplateManager.php @@ -36,7 +36,6 @@ use OCP\Files\GenericFileException; use OCP\Files\IRootFolder; use OCP\Files\Node; use OCP\Files\NotFoundException; -use OCP\Files\NotPermittedException; use OCP\Files\Template\FileCreatedFromTemplateEvent; use OCP\Files\Template\ICustomTemplateProvider; use OCP\Files\Template\ITemplateManager; @@ -299,9 +298,10 @@ class TemplateManager implements ITemplateManager { } try { - $folder = $userFolder->newFolder($userTemplatePath); - } catch (NotPermittedException $e) { $folder = $userFolder->get($userTemplatePath); + } catch (NotFoundException $e) { + $folder = $userFolder->get(dirname($userTemplatePath)); + $folder = $folder->newFolder(basename($userTemplatePath)); } $folderIsEmpty = count($folder->getDirectoryListing()) === 0; |