fix: don't create an empty file before writing the contents in OC_Util::copyr

Signed-off-by: Robin Appelman <robin@icewind.nl>
This commit is contained in:
Robin Appelman 2025-06-12 19:48:32 +02:00
parent d161e07cf7
commit 1d2b991bda

View file

@ -187,14 +187,13 @@ class OC_Util {
$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);
}
}
}