also encrypt files in trash bin
This commit is contained in:
parent
73a3086945
commit
7d492fefae
|
@ -321,7 +321,7 @@ class Encryption implements IEncryptionModule {
|
|||
*/
|
||||
public function shouldEncrypt($path) {
|
||||
$parts = explode('/', $path);
|
||||
if (count($parts) < 3) {
|
||||
if (count($parts) < 4) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -331,6 +331,9 @@ class Encryption implements IEncryptionModule {
|
|||
if ($parts[2] == 'files_versions') {
|
||||
return true;
|
||||
}
|
||||
if ($parts[2] == 'files_trashbin') {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -220,4 +220,29 @@ class EncryptionTest extends TestCase {
|
|||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* by default the encryption module should encrypt regular files, files in
|
||||
* files_versions and files in files_trashbin
|
||||
*
|
||||
* @dataProvider dataTestShouldEncrypt
|
||||
*/
|
||||
public function testShouldEncrypt($path, $expected) {
|
||||
$this->assertSame($expected,
|
||||
$this->instance->shouldEncrypt($path)
|
||||
);
|
||||
}
|
||||
|
||||
public function dataTestShouldEncrypt() {
|
||||
return array(
|
||||
array('/user1/files/foo.txt', true),
|
||||
array('/user1/files_versions/foo.txt', true),
|
||||
array('/user1/files_trashbin/foo.txt', true),
|
||||
array('/user1/some_folder/foo.txt', false),
|
||||
array('/user1/foo.txt', false),
|
||||
array('/user1/files', false),
|
||||
array('/user1/files_trashbin', false),
|
||||
array('/user1/files_versions', false),
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue