diff options
author | Vincent Petry <pvince81@owncloud.com> | 2016-08-18 13:53:51 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-08-18 13:53:51 +0300 |
commit | 45e40494a0c912f79b3d582adb97a3ed9a014f1e (patch) | |
tree | ea3150613cfdc83011e81ea4733929198db58578 | |
parent | 3306473ea7250da782bdd9a2e11d9c29dee0c3c1 (diff) | |
parent | 4913b5991e057a17c308ac1d5661f1475fb32f55 (diff) |
Merge pull request #25832 from owncloud/stable9-dont-decrypt-shared-files
[stable9] Don't decrypt shared files
-rw-r--r-- | lib/private/encryption/decryptall.php | 4 | ||||
-rw-r--r-- | tests/lib/encryption/decryptalltest.php | 10 |
2 files changed, 11 insertions, 3 deletions
diff --git a/lib/private/encryption/decryptall.php b/lib/private/encryption/decryptall.php index 34a3e1bff91..376cdd3d5aa 100644 --- a/lib/private/encryption/decryptall.php +++ b/lib/private/encryption/decryptall.php @@ -206,6 +206,10 @@ class DecryptAll { 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 d7cf2fb7baf..3f7cb59c8f4 100644 --- a/tests/lib/encryption/decryptalltest.php +++ b/tests/lib/encryption/decryptalltest.php @@ -239,6 +239,10 @@ class DecryptAllTest extends TestCase { } 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 @@ class DecryptAllTest extends TestCase { $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) ] ); |