fix: get object size from stream where possible

Signed-off-by: Robin Appelman <robin@icewind.nl>
This commit is contained in:
Robin Appelman 2024-12-05 15:16:22 +01:00
parent e4d0882b31
commit 6cf66f95ce
No known key found for this signature in database
GPG key ID: 42B69D8A64526EFB

View file

@ -457,6 +457,14 @@ class ObjectStoreStorage extends \OC\Files\Storage\Common implements IChunkedFil
}
public function writeStream(string $path, $stream, ?int $size = null): int {
if ($size === null) {
$stats = fstat($stream);
if (is_array($stats) && isset($stats['size'])) {
$size = $stats['size'];
$this->logger->warning("stream size $size");
}
}
$stat = $this->stat($path);
if (empty($stat)) {
// create new file