From 56de083376117ab82853fe18f1b9ef96e7142acb 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 | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/private/Files/Template/TemplateManager.php b/lib/private/Files/Template/TemplateManager.php index 47011f875ae12..d0e5ae3fe6f09 100644 --- a/lib/private/Files/Template/TemplateManager.php +++ b/lib/private/Files/Template/TemplateManager.php @@ -175,9 +175,12 @@ public function createFromTemplate(string $filePath, string $templateId = '', st */ private function getTemplateFolder(): Node { 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; + } } - throw new NotFoundException(); + throw new NotFoundException('Template folder not found or invalid'); } /**