From 66837115162a7f722ee7e11e207cbc7a0ebf9d56 Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Wed, 18 Sep 2024 11:14:20 +0200 Subject: fix: cleanup objectstore file_put_content Signed-off-by: Robin Appelman --- lib/private/Files/ObjectStore/ObjectStoreStorage.php | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) (limited to 'lib/private') diff --git a/lib/private/Files/ObjectStore/ObjectStoreStorage.php b/lib/private/Files/ObjectStore/ObjectStoreStorage.php index b510980f7fd..63fb0d92bb0 100644 --- a/lib/private/Files/ObjectStore/ObjectStoreStorage.php +++ b/lib/private/Files/ObjectStore/ObjectStoreStorage.php @@ -485,13 +485,10 @@ class ObjectStoreStorage extends \OC\Files\Storage\Common implements IChunkedFil } public function file_put_contents($path, $data) { - $handle = $this->fopen($path, 'w+'); - if (!$handle) { - return false; - } - $result = fwrite($handle, $data); - fclose($handle); - return $result; + $fh = fopen('php://temp', 'w+'); + fwrite($fh, $data); + rewind($fh); + return $this->writeStream($path, $fh, strlen($data)); } public function writeStream(string $path, $stream, ?int $size = null): int { -- cgit v1.2.3