aboutsummaryrefslogtreecommitdiffstats
path: root/lib/private
diff options
context:
space:
mode:
Diffstat (limited to 'lib/private')
-rw-r--r--lib/private/Files/Storage/Local.php2
-rw-r--r--lib/private/Files/Template/TemplateManager.php4
2 files changed, 2 insertions, 4 deletions
diff --git a/lib/private/Files/Storage/Local.php b/lib/private/Files/Storage/Local.php
index 2ae22d33d2e..19e977c43f8 100644
--- a/lib/private/Files/Storage/Local.php
+++ b/lib/private/Files/Storage/Local.php
@@ -142,7 +142,7 @@ class Local extends \OC\Files\Storage\Common {
* @var \SplFileInfo $file
*/
$file = $it->current();
- clearstatcache(true, $this->getSourcePath($file));
+ clearstatcache(true, $file->getRealPath());
if (in_array($file->getBasename(), ['.', '..'])) {
$it->next();
continue;
diff --git a/lib/private/Files/Template/TemplateManager.php b/lib/private/Files/Template/TemplateManager.php
index 9d9f6416208..04ebcdf66a3 100644
--- a/lib/private/Files/Template/TemplateManager.php
+++ b/lib/private/Files/Template/TemplateManager.php
@@ -159,11 +159,9 @@ class TemplateManager implements ITemplateManager {
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,9 +169,9 @@ class TemplateManager implements ITemplateManager {
$provider = array_shift($matchingProvider);
if ($provider) {
$template = $provider->getCustomTemplate($templateId);
- $template->copy($targetFile->getPath());
}
}
+ $targetFile = $folder->newFile(basename($filePath), ($template instanceof File ? $template->fopen('rb') : null));
$this->eventDispatcher->dispatchTyped(new FileCreatedFromTemplateEvent($template, $targetFile));
return $this->formatFile($userFolder->get($filePath));
} catch (\Exception $e) {