Skip to content

Commit

Permalink
Merge pull request #49876 from nextcloud/backport/49451/stable29
Browse files Browse the repository at this point in the history
[stable29] fix(TemplateManager): Make sure TemplateFolder is a Folder
  • Loading branch information
solracsf authored Dec 16, 2024
2 parents 0fe1a77 + c085c1b commit 2fae31f
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions lib/private/Files/Template/TemplateManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down

0 comments on commit 2fae31f

Please sign in to comment.