]> source.dussan.org Git - nextcloud-server.git/commitdiff
Fixing encryption stream wrapper seek - thanks @jknockaert
authorjknockaert <jasper@knockaert.nl>
Thu, 2 Apr 2015 12:52:54 +0000 (14:52 +0200)
committerThomas Müller <thomas.mueller@tmit.eu>
Tue, 7 Apr 2015 11:30:30 +0000 (13:30 +0200)
lib/private/files/stream/encryption.php

index fcc9984500dba9bfb92be43dec00d3daa5611a3e..fdfe73d99c53b94214897c0938fe768747f678bc 100644 (file)
@@ -362,8 +362,11 @@ class Encryption extends Wrapper {
                $newFilePosition = floor($newPosition / $this->unencryptedBlockSize)
                        * $this->util->getBlockSize() + $this->util->getHeaderSize();
 
+               $oldFilePosition = parent::stream_tell();
                if (parent::stream_seek($newFilePosition)) {
+                       parent::stream_seek($oldFilePosition);
                        $this->flush();
+                       parent::stream_seek($newFilePosition);
                        $this->position = $newPosition;
                        $return = true;
                }