diff options
Diffstat (limited to 'apps/files_external/lib/Lib/Storage/AmazonS3.php')
-rw-r--r-- | apps/files_external/lib/Lib/Storage/AmazonS3.php | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/apps/files_external/lib/Lib/Storage/AmazonS3.php b/apps/files_external/lib/Lib/Storage/AmazonS3.php index f26dcc3de02..2e343d8e469 100644 --- a/apps/files_external/lib/Lib/Storage/AmazonS3.php +++ b/apps/files_external/lib/Lib/Storage/AmazonS3.php @@ -42,6 +42,7 @@ use Icewind\Streams\CallbackWrapper; use Icewind\Streams\IteratorDirectory; use OC\Files\ObjectStore\S3ConnectionTrait; use OC\Files\ObjectStore\S3ObjectTrait; +use OCP\Constants; class AmazonS3 extends \OC\Files\Storage\Common { use S3ConnectionTrait; @@ -339,6 +340,12 @@ class AmazonS3 extends \OC\Files\Storage\Common { } case 'w': case 'wb': + $tmpFile = \OCP\Files::tmpFile(); + + $handle = fopen($tmpFile, 'w'); + return CallbackWrapper::wrap($handle, null, null, function () use ($path, $tmpFile) { + $this->writeBack($tmpFile, $path); + }); case 'a': case 'ab': case 'r+': @@ -506,11 +513,12 @@ class AmazonS3 extends \OC\Files\Storage\Common { public function writeBack($tmpFile, $path) { try { - $source = $this->fopen($tmpFile, 'r'); + $source = fopen($tmpFile, 'r'); $this->writeObject($path, $source); fclose($source); unlink($tmpFile); + return true; } catch (S3Exception $e) { \OCP\Util::logException('files_external', $e); return false; |