]> source.dussan.org Git - nextcloud-server.git/commitdiff
if we start writing a file from the beginning, size should start by zero; result...
authorBjoern Schiessle <schiessle@owncloud.com>
Wed, 15 Apr 2015 11:17:01 +0000 (13:17 +0200)
committerBjoern Schiessle <schiessle@owncloud.com>
Thu, 16 Apr 2015 12:15:04 +0000 (14:15 +0200)
lib/private/files/stream/encryption.php

index 9ba98e61d3eeaa786b1a50130477c7f4891469e2..4a1df840105729644b45d92b3598cac51636f3ad 100644 (file)
@@ -280,7 +280,7 @@ class Encryption extends Wrapper {
 
                if ($this->position === 0) {
                        $this->writeHeader();
-                       $this->size+=$this->util->getHeaderSize();
+                       $this->size = $this->util->getHeaderSize();
                }
 
                $length = 0;
@@ -293,7 +293,7 @@ class Encryption extends Wrapper {
 
                        // for seekable streams the pointer is moved back to the beginning of the encrypted block
                        // flush will start writing there when the position moves to another block
-                       $positionInFile = floor($this->position / $this->unencryptedBlockSize) *
+                       $positionInFile = (int)floor($this->position / $this->unencryptedBlockSize) *
                                $this->util->getBlockSize() + $this->util->getHeaderSize();
                        $resultFseek = parent::stream_seek($positionInFile);