From: jknockaert Date: Thu, 2 Apr 2015 12:52:54 +0000 (+0200) Subject: Fixing encryption stream wrapper seek - thanks @jknockaert X-Git-Tag: v8.1.0alpha1~78^2~23 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=02404a6a8cd07ca79add601deaefe3b4940eddfa;p=nextcloud-server.git Fixing encryption stream wrapper seek - thanks @jknockaert --- diff --git a/lib/private/files/stream/encryption.php b/lib/private/files/stream/encryption.php index fcc9984500d..fdfe73d99c5 100644 --- a/lib/private/files/stream/encryption.php +++ b/lib/private/files/stream/encryption.php @@ -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; }