mirror of
https://github.com/nextcloud/server.git
synced 2026-05-28 04:32:30 -04:00
fix(encryption): Take encryption enabled status into account
shouldEncrypt now returns false for all paths if encryption is disabled. Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
This commit is contained in:
parent
feef3cfa7d
commit
bccec549e5
1 changed files with 5 additions and 2 deletions
|
|
@ -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) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue