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 1 commit 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.

@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.

@solracsf solracsf requested review from a team, ArtificialOwl, icewind1991 and provokateurin and removed request for a team December 13, 2024 08:18
@solracsf
Copy link
Member Author

/backport to stable30

@solracsf
Copy link
Member Author

/backport to stable29

@solracsf solracsf force-pushed the ensureTemplateFolder branch from cd4c53b to efa615b Compare December 13, 2024 10:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants