Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(TemplateManager): Make sure TemplateFolder is a Folder #49451

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

solracsf
Copy link
Member

@solracsf solracsf commented Nov 23, 2024

Checklist

@joshtrichards
Copy link
Member

joshtrichards commented Nov 23, 2024

LOL I just wrote basically the same code and was about to shoot over the PR:

	private function getTemplateFolder(): Node {
		if ($this->getTemplatePath() !== '') {
			$userTemplateFolder = $this->rootFolder->getUserFolder($this->userId)->get($this->getTemplatePath());
			if ($userTemplateFolder->getType() === \OCP\Files\FileInfo::TYPE_FOLDER) {
				return $userTemplateFolder;
			}
		}
		throw new NotFoundException();
	}

Both re-trigger the new template folder setup setting (good). I didn't make the exception message more verbose though. Since it's caught silently when used in getTemplateFiles() I think re-triggering the Create new template folder option is enough (but won't hurt!).

Copy link
Member

@joshtrichards joshtrichards left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested/works.

Signed-off-by: Git'Fellow <[email protected]>
@solracsf
Copy link
Member Author

I didn't make the exception message more verbose though.

I've added a separate log line instead, could help when user expects something but get nothing and can't understand why.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants