Merge pull request #53461 from nextcloud/copyr-no-empty-newfile

fix: don't create an empty file before writing the contents in OC_Util::copyr
pull/53676/head
Robin Appelman 4 months ago committed by GitHub
commit f057a2054c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 3
      lib/private/legacy/OC_Util.php

@ -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);
}
}
}

Loading…
Cancel
Save