diff options
author | Julius Härtl <jus@bitgrid.net> | 2021-03-31 16:21:40 +0200 |
---|---|---|
committer | Julius Härtl <jus@bitgrid.net> | 2021-04-01 13:48:21 +0200 |
commit | 6fd571461c32fc46c63943454c5087064a96b759 (patch) | |
tree | 21dea2f4212f4520af30c59fae40ae7de10400ca /lib/private/Files/Template | |
parent | 37591f05dca56090059c4356636406c8982d3f33 (diff) | |
download | nextcloud-server-6fd571461c32fc46c63943454c5087064a96b759.tar.gz nextcloud-server-6fd571461c32fc46c63943454c5087064a96b759.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/Files/Template')
-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 c1dd4f3448e..0351e122658 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; @@ -300,9 +299,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; |