From: Thomas Müller Date: Wed, 1 Apr 2015 10:35:12 +0000 (+0200) Subject: file_put_contents has to return the number of written bytes X-Git-Tag: v8.1.0alpha1~78^2~52 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=137c13566499beb70a099162919c02146136f020;p=nextcloud-server.git file_put_contents has to return the number of written bytes --- 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 {