From a7f33f2aae9f3289fdae44d39922cfa2c1aaee41 Mon Sep 17 00:00:00 2001 From: Julius Knorr Date: Tue, 10 Sep 2024 09:43:42 +0200 Subject: [PATCH] fix: Only write once to template instead of create/copy Signed-off-by: Julius Knorr [skip ci] --- lib/private/Files/Template/TemplateManager.php | 3 --- 1 file changed, 3 deletions(-) diff --git a/lib/private/Files/Template/TemplateManager.php b/lib/private/Files/Template/TemplateManager.php index 3f3c36de5f151..b30ad3f6373eb 100644 --- a/lib/private/Files/Template/TemplateManager.php +++ b/lib/private/Files/Template/TemplateManager.php @@ -159,11 +159,9 @@ public function createFromTemplate(string $filePath, string $templateId = '', st throw new GenericFileException($this->l10n->t('Invalid path')); } $folder = $userFolder->get(dirname($filePath)); - $targetFile = $folder->newFile(basename($filePath)); $template = null; if ($templateType === 'user' && $templateId !== '') { $template = $userFolder->get($templateId); - $template->copy($targetFile->getPath()); } else { $matchingProvider = array_filter($this->getRegisteredProviders(), function (ICustomTemplateProvider $provider) use ($templateType) { return $templateType === get_class($provider); @@ -171,7 +169,6 @@ public function createFromTemplate(string $filePath, string $templateId = '', st $provider = array_shift($matchingProvider); if ($provider) { $template = $provider->getCustomTemplate($templateId); - $template->copy($targetFile->getPath()); } } $this->eventDispatcher->dispatchTyped(new FileCreatedFromTemplateEvent($template, $targetFile));