Skip to content

Commit efa615b

Browse files
committed
fix(TemplateManager): Make sure TemplateFolder is a Folder
Signed-off-by: Git'Fellow <[email protected]>
1 parent fef721e commit efa615b

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

lib/private/Files/Template/TemplateManager.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -173,9 +173,13 @@ public function createFromTemplate(string $filePath, string $templateId = '', st
173173
* @throws \OCP\Files\NotPermittedException
174174
* @throws \OC\User\NoUserException
175175
*/
176-
private function getTemplateFolder(): Node {
176+
private function getTemplateFolder(): Folder {
177177
if ($this->getTemplatePath() !== '') {
178-
return $this->rootFolder->getUserFolder($this->userId)->get($this->getTemplatePath());
178+
$path = $this->rootFolder->getUserFolder($this->userId)->get($this->getTemplatePath());
179+
if ($path instanceof Folder) {
180+
return $path;
181+
}
182+
$this->logger->warning('Template folder ' . $path . ' not found or invalid', ['app' => 'files_templates']);
179183
}
180184
throw new NotFoundException();
181185
}

0 commit comments

Comments
 (0)