mirror of
https://github.com/nextcloud/server.git
synced 2026-06-13 18:50:47 -04:00
fix(encryption): Correctly set encrypted to 0 when copying
If encryption got disabled, copying should set encrypted to 0 for the new unencrypted copy. For instance when using encryption:decrypt-all Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
This commit is contained in:
parent
b54731d47a
commit
813507ebd2
1 changed files with 10 additions and 1 deletions
|
|
@ -644,6 +644,13 @@ class Cache implements ICache {
|
|||
return $this->storage->instanceOfStorage(Encryption::class);
|
||||
}
|
||||
|
||||
protected function shouldEncrypt(string $targetPath): bool {
|
||||
if (!$this->storage->instanceOfStorage(Encryption::class)) {
|
||||
return false;
|
||||
}
|
||||
return $this->storage->shouldEncrypt($targetPath);
|
||||
}
|
||||
|
||||
/**
|
||||
* Move a file or folder in the cache
|
||||
*
|
||||
|
|
@ -1158,7 +1165,9 @@ class Cache implements ICache {
|
|||
$data = $this->cacheEntryToArray($sourceEntry);
|
||||
|
||||
// when moving from an encrypted storage to a non-encrypted storage remove the `encrypted` mark
|
||||
if ($sourceCache instanceof Cache && $sourceCache->hasEncryptionWrapper() && !$this->hasEncryptionWrapper()) {
|
||||
if ($sourceCache instanceof Cache
|
||||
&& $sourceCache->hasEncryptionWrapper()
|
||||
&& !$this->shouldEncrypt($targetPath)) {
|
||||
$data['encrypted'] = 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue