Merge pull request #49877 from nextcloud/backport/49451/stable30

[stable30] fix(TemplateManager): Make sure TemplateFolder is a Folder
This commit is contained in:
Git'Fellow 2024-12-16 08:27:19 +01:00 committed by GitHub
commit 35c0ed1199
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -173,9 +173,13 @@ class TemplateManager implements ITemplateManager {
* @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();
}