diff --git a/lib/private/Files/Storage/Wrapper/Encryption.php b/lib/private/Files/Storage/Wrapper/Encryption.php index 0f5c47dae3f..ac83d90f81a 100644 --- a/lib/private/Files/Storage/Wrapper/Encryption.php +++ b/lib/private/Files/Storage/Wrapper/Encryption.php @@ -337,7 +337,7 @@ class Encryption extends Wrapper { } // encryption disabled on write of new file and write to existing unencrypted file -> don't encrypt - if (!$encryptionEnabled || !$this->shouldEncrypt($path)) { + if (!$this->shouldEncrypt($path)) { if (!$targetExists || !$targetIsEncrypted) { $shouldEncrypt = false; } @@ -585,7 +585,7 @@ class Encryption extends Wrapper { bool $isRename, bool $keepEncryptionVersion, ): void { - $isEncrypted = $this->encryptionManager->isEnabled() && $this->shouldEncrypt($targetInternalPath); + $isEncrypted = $this->shouldEncrypt($targetInternalPath); $cacheInformation = [ 'encrypted' => $isEncrypted, ]; @@ -885,6 +885,9 @@ class Encryption extends Wrapper { * check if the given storage should be encrypted or not */ public function shouldEncrypt(string $path): bool { + if (!$this->encryptionManager->isEnabled()) { + return false; + } $fullPath = $this->getFullPath($path); $mountPointConfig = $this->mount->getOption('encrypt', true); if ($mountPointConfig === false) {