]> source.dussan.org Git - nextcloud-server.git/commitdiff
fix: cleanup objectstore file_put_content
authorRobin Appelman <robin@icewind.nl>
Wed, 18 Sep 2024 09:14:20 +0000 (11:14 +0200)
committerLouis <louis@chmn.me>
Tue, 8 Oct 2024 16:14:26 +0000 (18:14 +0200)
Signed-off-by: Robin Appelman <robin@icewind.nl>
lib/private/Files/ObjectStore/ObjectStoreStorage.php

index c712494f4f58380591ae9e5c70cc3b9f078ec318..056776326076090dc00f6e6aee8e984d24c4891d 100644 (file)
@@ -481,13 +481,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 {