diff --git a/apps/files_external/lib/Service/DBConfigService.php b/apps/files_external/lib/Service/DBConfigService.php index d6135ff88cccb..69c1b39b4d07a 100644 --- a/apps/files_external/lib/Service/DBConfigService.php +++ b/apps/files_external/lib/Service/DBConfigService.php @@ -384,7 +384,7 @@ public function setConfig(int $mountId, string $key, string $value): void { } } - public function setOption(int $mountId, string $key, string $value): void { + public function setOption(int $mountId, string $key, mixed $value): void { try { $builder = $this->connection->getQueryBuilder(); $builder->insert('external_options') diff --git a/apps/files_external/tests/Service/DBConfigServiceTest.php b/apps/files_external/tests/Service/DBConfigServiceTest.php index 989f8b918adf9..48af029607676 100644 --- a/apps/files_external/tests/Service/DBConfigServiceTest.php +++ b/apps/files_external/tests/Service/DBConfigServiceTest.php @@ -149,9 +149,11 @@ public function testSetOption(): void { $this->assertEquals(['foo' => 'bar'], $mount['options']); $this->dbConfig->setOption($id, 'foo2', 'bar2'); + $this->dbConfig->setOption($id, 'disabled', false); $mount = $this->dbConfig->getMountById($id); - $this->assertEquals(['foo' => 'bar', 'foo2' => 'bar2'], $mount['options']); + $this->assertEquals(['foo' => 'bar', 'foo2' => 'bar2', 'disabled' => false], $mount['options']); + $this->assertSame(false, $mount['options']['disabled']); } public function testSetOptionOverwrite(): void { diff --git a/apps/files_external/tests/Service/UserStoragesServiceTest.php b/apps/files_external/tests/Service/UserStoragesServiceTest.php index 287ccbf377822..6acc46dbaf08c 100644 --- a/apps/files_external/tests/Service/UserStoragesServiceTest.php +++ b/apps/files_external/tests/Service/UserStoragesServiceTest.php @@ -79,6 +79,7 @@ public function testAddStorage(): void { $this->assertEquals($storage->getBackend(), $newStorage->getBackend()); $this->assertEquals($storage->getAuthMechanism(), $newStorage->getAuthMechanism()); $this->assertEquals($storage->getBackendOptions(), $newStorage->getBackendOptions()); + $this->assertSame($storage->getMountOptions(), $newStorage->getMountOptions()); $this->assertEquals(0, $newStorage->getStatus()); // hook called once for user diff --git a/lib/private/Files/Storage/Wrapper/Encryption.php b/lib/private/Files/Storage/Wrapper/Encryption.php index a3ed3f4eb871f..28051737132b2 100644 --- a/lib/private/Files/Storage/Wrapper/Encryption.php +++ b/lib/private/Files/Storage/Wrapper/Encryption.php @@ -985,7 +985,7 @@ public function shouldEncrypt(string $path): bool { } $fullPath = $this->getFullPath($path); $mountPointConfig = $this->mount->getOption('encrypt', true); - if ($mountPointConfig === false) { + if ($mountPointConfig === false || $mountPointConfig === '') { return false; } diff --git a/tests/lib/Files/Storage/Wrapper/EncryptionTest.php b/tests/lib/Files/Storage/Wrapper/EncryptionTest.php index 0e22db203d1ce..8e3ce8cfecae3 100644 --- a/tests/lib/Files/Storage/Wrapper/EncryptionTest.php +++ b/tests/lib/Files/Storage/Wrapper/EncryptionTest.php @@ -1155,7 +1155,7 @@ public static function dataTestIsVersion(): array { #[\PHPUnit\Framework\Attributes\DataProvider('dataTestShouldEncrypt')] public function testShouldEncrypt( bool $encryptionEnabled, - bool $encryptMountPoint, + bool|string $encryptMountPoint, ?bool $encryptionModule, bool $encryptionModuleShouldEncrypt, bool $expected, @@ -1233,6 +1233,7 @@ function () use ($encryptionModule) { public static function dataTestShouldEncrypt(): array { return [ [true, false, false, false, false], + [true, '', false, false, false], [true, true, false, false, false], [true, true, true, false, false], [true, true, true, true, true],