From 137c13566499beb70a099162919c02146136f020 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Thomas=20M=C3=BCller?= Date: Wed, 1 Apr 2015 12:35:12 +0200 Subject: [PATCH] file_put_contents has to return the number of written bytes --- lib/private/files/storage/wrapper/encryption.php | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/lib/private/files/storage/wrapper/encryption.php b/lib/private/files/storage/wrapper/encryption.php index 43052af8448..3e980984191 100644 --- a/lib/private/files/storage/wrapper/encryption.php +++ b/lib/private/files/storage/wrapper/encryption.php @@ -135,8 +135,9 @@ class Encryption extends Wrapper { public function file_put_contents($path, $data) { // file put content will always be translated to a stream write $handle = $this->fopen($path, 'w'); - fwrite($handle, $data); - return fclose($handle); + $written = fwrite($handle, $data); + fclose($handle); + return $written; } /** @@ -250,13 +251,8 @@ class Encryption extends Wrapper { if($shouldEncrypt === true && !$this->util->isExcluded($fullPath) && $encryptionModule !== null) { $source = $this->storage->fopen($path, $mode); - $uid = $this->uid; - if (is_null($uid)) { - list($owner, ) = $this->util->getUidAndFilename($fullPath); - $uid = $owner; - } $handle = \OC\Files\Stream\Encryption::wrap($source, $path, $fullPath, $header, - $uid, $encryptionModule, $this->storage, $this, $this->util, $this->fileHelper, $mode, + $this->uid, $encryptionModule, $this->storage, $this, $this->util, $this->fileHelper, $mode, $size, $unencryptedSize); return $handle; } else { -- 2.39.5