calling renameKeys() on directory level as well - fixes #15778
This commit is contained in:
parent
fc4127dd62
commit
987bc138df
2 changed files with 18 additions and 9 deletions
|
@ -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();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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');
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
|
|
Loading…
Reference in a new issue