Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Müller <thomas.mueller@tmit.eu>2015-08-03 13:54:01 +0300
committerThomas Müller <thomas.mueller@tmit.eu>2015-08-03 13:54:01 +0300
commita0ab86bb91a9cc20e426b2a539212de4d527b51f (patch)
treefa5c1b4ec823fb1707c28e9b3cb380b71cec6c6f
parentab16bea5c73d9a89a6a8f57b7ab08fc0d2e11441 (diff)
parent2e8f47dfb6fe9d4ae8861dbf9fb9ec2f20a1c3b7 (diff)
Merge pull request #18013 from owncloud/enc_always_update_file_cache_8.1
[stable8.1] let the encryption storage wrapper always update the file cache
-rw-r--r--lib/private/files/storage/wrapper/encryption.php9
-rw-r--r--tests/lib/files/storage/wrapper/encryption.php8
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 51aa13065c1..4ba9b21ddb4 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 612cf827975..c49e6bb0d1f 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');