Skip to content

Commit 5a6ec82

Browse files
juliusknorrbackportbot[bot]
authored andcommitted
fix: Only write once to template instead of create/copy
Signed-off-by: Julius Knorr <jus@bitgrid.net> [skip ci]
1 parent bfb9c9b commit 5a6ec82

1 file changed

Lines changed: 0 additions & 3 deletions

File tree

lib/private/Files/Template/TemplateManager.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -159,19 +159,16 @@ public function createFromTemplate(string $filePath, string $templateId = '', st
159159
throw new GenericFileException($this->l10n->t('Invalid path'));
160160
}
161161
$folder = $userFolder->get(dirname($filePath));
162-
$targetFile = $folder->newFile(basename($filePath));
163162
$template = null;
164163
if ($templateType === 'user' && $templateId !== '') {
165164
$template = $userFolder->get($templateId);
166-
$template->copy($targetFile->getPath());
167165
} else {
168166
$matchingProvider = array_filter($this->getRegisteredProviders(), function (ICustomTemplateProvider $provider) use ($templateType) {
169167
return $templateType === get_class($provider);
170168
});
171169
$provider = array_shift($matchingProvider);
172170
if ($provider) {
173171
$template = $provider->getCustomTemplate($templateId);
174-
$template->copy($targetFile->getPath());
175172
}
176173
}
177174
$this->eventDispatcher->dispatchTyped(new FileCreatedFromTemplateEvent($template, $targetFile));

0 commit comments

Comments
 (0)