Skip to content

Commit 9f7c05c

Browse files
authored
Merge pull request #30695 from nextcloud/backport/30631/stable23
[stable23] updateEncryptedVersion: cleanup on target if cache already got renamed
2 parents 5bebac3 + 9da4620 commit 9f7c05c

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

lib/private/Files/Storage/Wrapper/Encryption.php

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -694,7 +694,16 @@ private function updateEncryptedVersion(Storage\IStorage $sourceStorage, $source
694694
'encrypted' => $isEncrypted,
695695
];
696696
if ($isEncrypted) {
697-
$encryptedVersion = $sourceStorage->getCache()->get($sourceInternalPath)['encryptedVersion'];
697+
$sourceCacheEntry = $sourceStorage->getCache()->get($sourceInternalPath);
698+
$targetCacheEntry = $this->getCache()->get($targetInternalPath);
699+
700+
// Rename of the cache already happened, so we do the cleanup on the target
701+
if ($sourceCacheEntry === false && $targetCacheEntry !== false) {
702+
$encryptedVersion = $targetCacheEntry['encryptedVersion'];
703+
$isRename = false;
704+
} else {
705+
$encryptedVersion = $sourceCacheEntry['encryptedVersion'];
706+
}
698707

699708
// In case of a move operation from an unencrypted to an encrypted
700709
// storage the old encrypted version would stay with "0" while the

0 commit comments

Comments
 (0)