From c085c1bc45acb97b1f03d01e020ffdcbef00b92d Mon Sep 17 00:00:00 2001 From: Git'Fellow <12234510+solracsf@users.noreply.github.com> Date: Sat, 23 Nov 2024 08:07:31 +0100 Subject: [PATCH] fix(TemplateManager): Make sure TemplateFolder is a Folder Signed-off-by: Git'Fellow <12234510+solracsf@users.noreply.github.com> --- lib/private/Files/Template/TemplateManager.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/private/Files/Template/TemplateManager.php b/lib/private/Files/Template/TemplateManager.php index 46fd428b491db..3ef1262244074 100644 --- a/lib/private/Files/Template/TemplateManager.php +++ b/lib/private/Files/Template/TemplateManager.php @@ -186,9 +186,13 @@ public function createFromTemplate(string $filePath, string $templateId = '', st * @throws \OCP\Files\NotPermittedException * @throws \OC\User\NoUserException */ - private function getTemplateFolder(): Node { + private function getTemplateFolder(): Folder { if ($this->getTemplatePath() !== '') { - return $this->rootFolder->getUserFolder($this->userId)->get($this->getTemplatePath()); + $path = $this->rootFolder->getUserFolder($this->userId)->get($this->getTemplatePath()); + if ($path instanceof Folder) { + return $path; + } + $this->logger->warning('Template folder ' . $path . ' not found or invalid', ['app' => 'files_templates']); } throw new NotFoundException(); }