]> source.dussan.org Git - nextcloud-server.git/commitdiff
Always use a temp file for swift writes 15203/head
authorRoeland Jago Douma <roeland@famdouma.nl>
Thu, 18 Apr 2019 19:04:27 +0000 (21:04 +0200)
committerBackportbot <backportbot-noreply@rullzer.com>
Wed, 24 Apr 2019 07:01:36 +0000 (07:01 +0000)
Apparently the if statement doesn't work in all cases (even if I could
not reproduce it). So for the time being we will just not directly
stream to swift.

Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
lib/private/Files/ObjectStore/Swift.php

index 7e4654b6eb242e42da6c79e9aae0622f084725e2..fd416157635b48809d3e2e93a07bd0135a6f4bf6 100644 (file)
@@ -76,14 +76,9 @@ class Swift implements IObjectStore {
         * @throws \Exception from openstack lib when something goes wrong
         */
        public function writeObject($urn, $stream) {
-               $handle = $stream;
-
-               $meta = stream_get_meta_data($stream);
-               if (!(isset($meta['seekable']) && $meta['seekable'] === true)) {
-                       $tmpFile = \OC::$server->getTempManager()->getTemporaryFile('swiftwrite');
-                       file_put_contents($tmpFile, $stream);
-                       $handle = fopen($tmpFile, 'rb');
-               }
+               $tmpFile = \OC::$server->getTempManager()->getTemporaryFile('swiftwrite');
+               file_put_contents($tmpFile, $stream);
+               $handle = fopen($tmpFile, 'rb');
 
                $this->getContainer()->createObject([
                        'name' => $urn,