diff --git a/lib/private/Encryption/DecryptAll.php b/lib/private/Encryption/DecryptAll.php index 34a3e1bff911..376cdd3d5aa9 100644 --- a/lib/private/Encryption/DecryptAll.php +++ b/lib/private/Encryption/DecryptAll.php @@ -206,6 +206,10 @@ protected function decryptUsersFiles($uid, ProgressBar $progress, $userCount) { while ($root = array_pop($directories)) { $content = $this->rootView->getDirectoryContent($root); foreach ($content as $file) { + // only decrypt files owned by the user + if($file->getStorage()->instanceOfStorage('OC\Files\Storage\Shared')) { + continue; + } $path = $root . '/' . $file['name']; if ($this->rootView->is_dir($path)) { $directories[] = $path; diff --git a/tests/lib/Encryption/DecryptAllTest.php b/tests/lib/Encryption/DecryptAllTest.php index d7cf2fb7baf7..3f7cb59c8f48 100644 --- a/tests/lib/Encryption/DecryptAllTest.php +++ b/tests/lib/Encryption/DecryptAllTest.php @@ -239,6 +239,10 @@ public function dataTestDecryptAllUsersFiles() { } public function testDecryptUsersFiles() { + $storage = $this->getMockBuilder('OC\Files\Storage\Shared') + ->disableOriginalConstructor() + ->getMock(); + /** @var DecryptAll | \PHPUnit_Framework_MockObject_MockObject $instance */ $instance = $this->getMockBuilder('OC\Encryption\DecryptAll') ->setConstructorArgs( @@ -254,15 +258,15 @@ public function testDecryptUsersFiles() { $this->view->expects($this->at(0))->method('getDirectoryContent') ->with('/user1/files')->willReturn( [ - new FileInfo('path', null, 'intPath', ['name' => 'foo', 'type'=>'dir'], null), - new FileInfo('path', null, 'intPath', ['name' => 'bar', 'type'=>'file', 'encrypted'=>true], null) + new FileInfo('path', $storage, 'intPath', ['name' => 'foo', 'type'=>'dir'], null), + new FileInfo('path', $storage, 'intPath', ['name' => 'bar', 'type'=>'file', 'encrypted'=>true], null) ] ); $this->view->expects($this->at(3))->method('getDirectoryContent') ->with('/user1/files/foo')->willReturn( [ - new FileInfo('path', null, 'intPath', ['name' => 'subfile', 'type'=>'file', 'encrypted'=>true], null) + new FileInfo('path', $storage, 'intPath', ['name' => 'subfile', 'type'=>'file', 'encrypted'=>true], null) ] );