From 1d2b991bda4d74499c55783bc98b317b2e589ba4 Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Thu, 12 Jun 2025 19:48:32 +0200 Subject: [PATCH] fix: don't create an empty file before writing the contents in OC_Util::copyr Signed-off-by: Robin Appelman --- lib/private/legacy/OC_Util.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/private/legacy/OC_Util.php b/lib/private/legacy/OC_Util.php index 87447af8adc28..41ac787aa80dd 100644 --- a/lib/private/legacy/OC_Util.php +++ b/lib/private/legacy/OC_Util.php @@ -187,14 +187,13 @@ public static function copyr($source, \OCP\Files\Folder $target) { $child = $target->newFolder($file); self::copyr($source . '/' . $file, $child); } else { - $child = $target->newFile($file); $sourceStream = fopen($source . '/' . $file, 'r'); if ($sourceStream === false) { $logger->error(sprintf('Could not fopen "%s"', $source . '/' . $file), ['app' => 'core']); closedir($dir); return; } - $child->putContent($sourceStream); + $target->newFile($file, $sourceStream); } } }