Skip to content

Commit 293e555

Browse files
authored
Merge pull request #30694 from nextcloud/backport/30631/stable22
[stable22] updateEncryptedVersion: cleanup on target if cache already got renamed
2 parents 0e2bc53 + 5d1157c commit 293e555

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

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

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -666,7 +666,16 @@ private function updateEncryptedVersion(Storage\IStorage $sourceStorage, $source
666666
'encrypted' => $isEncrypted,
667667
];
668668
if ($isEncrypted) {
669-
$encryptedVersion = $sourceStorage->getCache()->get($sourceInternalPath)['encryptedVersion'];
669+
$sourceCacheEntry = $sourceStorage->getCache()->get($sourceInternalPath);
670+
$targetCacheEntry = $this->getCache()->get($targetInternalPath);
671+
672+
// Rename of the cache already happened, so we do the cleanup on the target
673+
if ($sourceCacheEntry === false && $targetCacheEntry !== false) {
674+
$encryptedVersion = $targetCacheEntry['encryptedVersion'];
675+
$isRename = false;
676+
} else {
677+
$encryptedVersion = $sourceCacheEntry['encryptedVersion'];
678+
}
670679

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

0 commit comments

Comments
 (0)