[Pkg-owncloud-commits] [owncloud] 02/122: calling renameKeys() on directory level as well - fixes #15778
David Prévot
taffit at moszumanska.debian.org
Sat May 9 00:00:00 UTC 2015
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to branch stable8
in repository owncloud.
commit 987bc138df89be2d0afdf268ab5c991b1bbe830b
Author: Thomas Müller <thomas.mueller at tmit.eu>
Date: Wed Apr 22 12:12:27 2015 +0200
calling renameKeys() on directory level as well - fixes #15778
---
lib/private/files/storage/wrapper/encryption.php | 10 +++-------
tests/lib/files/storage/wrapper/encryption.php | 17 +++++++++++++++--
2 files changed, 18 insertions(+), 9 deletions(-)
diff --git a/lib/private/files/storage/wrapper/encryption.php b/lib/private/files/storage/wrapper/encryption.php
index 14c9df9..04eb5fc 100644
--- a/lib/private/files/storage/wrapper/encryption.php
+++ b/lib/private/files/storage/wrapper/encryption.php
@@ -215,11 +215,8 @@ class Encryption extends Wrapper {
if (isset($this->unencryptedSize[$source])) {
$this->unencryptedSize[$target] = $this->unencryptedSize[$source];
}
- $encryptionModule = $this->getEncryptionModule($path2);
- if ($encryptionModule) {
- $keyStorage = $this->getKeyStorage($encryptionModule->getId());
- $keyStorage->renameKeys($source, $target);
- }
+ $keyStorage = $this->getKeyStorage();
+ $keyStorage->renameKeys($source, $target);
}
return $result;
@@ -438,8 +435,7 @@ class Encryption extends Wrapper {
* @return \OCP\Encryption\Keys\IStorage
*/
protected function getKeyStorage() {
- $keyStorage = \OC::$server->getEncryptionKeyStorage();
- return $keyStorage;
+ return \OC::$server->getEncryptionKeyStorage();
}
}
diff --git a/tests/lib/files/storage/wrapper/encryption.php b/tests/lib/files/storage/wrapper/encryption.php
index 1082caf..228c7b0 100644
--- a/tests/lib/files/storage/wrapper/encryption.php
+++ b/tests/lib/files/storage/wrapper/encryption.php
@@ -12,6 +12,11 @@ class Encryption extends \Test\Files\Storage\Storage {
*/
private $sourceStorage;
+ /**
+ * @var \OC\Encryption\Keys\Storage | \PHPUnit_Framework_MockObject_MockObject
+ */
+ private $keyStore;
+
public function setUp() {
parent::setUp();
@@ -54,7 +59,7 @@ class Encryption extends \Test\Files\Storage\Storage {
$logger = $this->getMock('\OC\Log');
$this->sourceStorage = new Temporary(array());
- $keyStore = $this->getMockBuilder('\OC\Encryption\Keys\Storage')
+ $this->keyStore = $this->getMockBuilder('\OC\Encryption\Keys\Storage')
->disableOriginalConstructor()->getMock();
$mount = $this->getMockBuilder('\OC\Files\Mount\MountPoint')
->disableOriginalConstructor()
@@ -67,7 +72,7 @@ class Encryption extends \Test\Files\Storage\Storage {
'mountPoint' => '/',
'mount' => $mount
],
- $encryptionManager, $util, $logger, $file, null, $keyStore
+ $encryptionManager, $util, $logger, $file, null, $this->keyStore
);
}
@@ -91,6 +96,14 @@ class Encryption extends \Test\Files\Storage\Storage {
$encryptionModule->expects($this->any())->method('getUnencryptedBlockSize')->willReturn(8192);
return $encryptionModule;
}
+
+ public function testRename() {
+ $this->keyStore
+ ->expects($this->once())
+ ->method('renameKeys');
+ $this->instance->mkdir('folder');
+ $this->instance->rename('folder', 'flodder');
+ }
}
//
--
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