[Pkg-owncloud-commits] [owncloud] 125/131: always update file cache, the cache can handle partial data correctly if the file doesn't already exists in the file cache
David Prévot
taffit at moszumanska.debian.org
Tue Aug 11 15:58:45 UTC 2015
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to annotated tag v8.1.1
in repository owncloud.
commit 2e8f47dfb6fe9d4ae8861dbf9fb9ec2f20a1c3b7
Author: Bjoern Schiessle <schiessle at owncloud.com>
Date: Fri Jul 31 15:44:27 2015 +0200
always update file cache, the cache can handle partial data correctly if the file doesn't already exists in the file cache
---
lib/private/files/storage/wrapper/encryption.php | 9 ++++-----
tests/lib/files/storage/wrapper/encryption.php | 8 +++++---
2 files changed, 9 insertions(+), 8 deletions(-)
diff --git a/lib/private/files/storage/wrapper/encryption.php b/lib/private/files/storage/wrapper/encryption.php
index 51aa130..4ba9b21 100644
--- a/lib/private/files/storage/wrapper/encryption.php
+++ b/lib/private/files/storage/wrapper/encryption.php
@@ -127,12 +127,11 @@ class Encryption extends Wrapper {
$info = $this->getCache()->get($path);
if (isset($this->unencryptedSize[$fullPath])) {
$size = $this->unencryptedSize[$fullPath];
+ // update file cache
+ $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;
}
diff --git a/tests/lib/files/storage/wrapper/encryption.php b/tests/lib/files/storage/wrapper/encryption.php
index 612cf82..c49e6bb 100644
--- a/tests/lib/files/storage/wrapper/encryption.php
+++ b/tests/lib/files/storage/wrapper/encryption.php
@@ -261,10 +261,12 @@ class Encryption extends \Test\Files\Storage\Storage {
->expects($this->once())
->method('copyKeys')
->willReturn($copyKeysReturn);
- $this->cache->expects($this->once())
+ $this->cache->expects($this->atLeastOnce())
->method('put')
- ->with($this->anything(), ['encrypted' => true])
- ->willReturn(true);
+ ->willReturnCallback(function($path, $data) {
+ $this->assertArrayHasKey('encrypted', $data);
+ $this->assertTrue($data['encrypted']);
+ });
} else {
$this->cache->expects($this->never())->method('put');
$this->keyStore->expects($this->never())->method('copyKeys');
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud.git
More information about the Pkg-owncloud-commits
mailing list