diff options
author | Björn Schießle <bjoern@schiessle.org> | 2015-04-14 16:48:04 +0200 |
---|---|---|
committer | Björn Schießle <bjoern@schiessle.org> | 2015-04-14 16:48:04 +0200 |
commit | 4f0437fbdef8e729167c1a8078e790c7983f69ef (patch) | |
tree | 81017dacc38eb0ecbabd22c08a17f7a460d6aa18 /lib | |
parent | 82cab257622759d1b64582f27de33a982c79c158 (diff) | |
parent | cbe30f740ede9df6ef30a7b65746957ca42996b2 (diff) | |
download | nextcloud-server-4f0437fbdef8e729167c1a8078e790c7983f69ef.tar.gz nextcloud-server-4f0437fbdef8e729167c1a8078e790c7983f69ef.zip |
Merge pull request #15598 from owncloud/fix-enc-file-size-master
Fix file size of encrypted files
Diffstat (limited to 'lib')
-rw-r--r-- | lib/private/files/storage/wrapper/encryption.php | 21 | ||||
-rw-r--r-- | lib/public/encryption/iencryptionmodule.php | 8 |
2 files changed, 13 insertions, 16 deletions
diff --git a/lib/private/files/storage/wrapper/encryption.php b/lib/private/files/storage/wrapper/encryption.php index 4136e008af9..5697139bd6b 100644 --- a/lib/private/files/storage/wrapper/encryption.php +++ b/lib/private/files/storage/wrapper/encryption.php @@ -91,21 +91,23 @@ class Encryption extends Wrapper { */ public function filesize($path) { $fullPath = $this->getFullPath($path); - $size = $this->storage->filesize($path); $info = $this->getCache()->get($path); - if (isset($this->unencryptedSize[$fullPath])) { $size = $this->unencryptedSize[$fullPath]; - } - if (isset($info['fileid'])) { - $info['encrypted'] = true; - $info['size'] = $size; - $this->getCache()->put($path, $info); + if (isset($info['fileid'])) { + $info['encrypted'] = true; + $info['size'] = $size; + $this->getCache()->put($path, $info); + } + return $size; } - return $size; + if (isset($info['fileid']) && $info['encrypted']) { + return $info['size']; + } + return $this->storage->filesize($path); } /** @@ -181,6 +183,9 @@ class Encryption extends Wrapper { $result = $this->storage->rename($path1, $path2); if ($result) { $target = $this->getFullPath($path2); + if (isset($this->unencryptedSize[$source])) { + $this->unencryptedSize[$target] = $this->unencryptedSize[$source]; + } $encryptionModule = $this->getEncryptionModule($path2); if ($encryptionModule) { $keyStorage = $this->getKeyStorage($encryptionModule->getId()); diff --git a/lib/public/encryption/iencryptionmodule.php b/lib/public/encryption/iencryptionmodule.php index c1ce7d99d78..d22ca0ec86c 100644 --- a/lib/public/encryption/iencryptionmodule.php +++ b/lib/public/encryption/iencryptionmodule.php @@ -97,14 +97,6 @@ interface IEncryptionModule { public function shouldEncrypt($path); /** - * calculate unencrypted size - * - * @param string $path to file - * @return integer unencrypted size - */ - public function calculateUnencryptedSize($path); - - /** * get size of the unencrypted payload per block. * ownCloud read/write files with a block size of 8192 byte * |