Skip to content

Commit

Permalink
Merge pull request #3065 from nextcloud/backport/3059/stable27
Browse files Browse the repository at this point in the history
  • Loading branch information
juliusknorr authored Jul 17, 2023
2 parents ae7e4af + d944c94 commit b9df9e9
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions lib/Listener/FileCreatedFromTemplateListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,13 @@ public function handle(Event $event): void {
// Empty template
if ($templateFile === null) {
$event->getTarget()->putContent($this->templateManager->getEmptyFileContent($event->getTarget()->getExtension()));
$templateType = $this->templateManager->getTemplateTypeForExtension($event->getTarget()->getExtension());
$emptyTemplates = $this->templateManager->getEmpty($templateType);
$emptyTemplate = array_shift($emptyTemplates);
if ($emptyTemplate && $this->templateManager->isSupportedTemplateSource($emptyTemplate->getExtension())) {
// Only use TemplateSource if supported filetype
$this->templateManager->setTemplateSource($event->getTarget()->getId(), $emptyTemplate->getId());
}
return;
}

Expand Down

0 comments on commit b9df9e9

Please sign in to comment.