diff options
author | Vincent Petry <vincent@nextcloud.com> | 2022-01-14 09:45:08 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-01-14 09:45:08 +0100 |
commit | cfafd797065d58fae27218e0b1d4e144523e8f1a (patch) | |
tree | 12f065a7b0836bfc2aab90a177d2aec304c59ed1 /lib/private/Files/Storage/Wrapper | |
parent | 4adb60660f6cf2c80b4d9d5cc846a01df84cbd15 (diff) | |
parent | a2f4c62c1914e7dfcac3229c2fda18ee54c0f150 (diff) | |
download | nextcloud-server-cfafd797065d58fae27218e0b1d4e144523e8f1a.tar.gz nextcloud-server-cfafd797065d58fae27218e0b1d4e144523e8f1a.zip |
Merge pull request #30631 from nextcloud/fix/update_encrypted_version
updateEncryptedVersion: cleanup on target if cache already got renamed
Diffstat (limited to 'lib/private/Files/Storage/Wrapper')
-rw-r--r-- | lib/private/Files/Storage/Wrapper/Encryption.php | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/lib/private/Files/Storage/Wrapper/Encryption.php b/lib/private/Files/Storage/Wrapper/Encryption.php index 3fb21fbc01c..75611d1ab0f 100644 --- a/lib/private/Files/Storage/Wrapper/Encryption.php +++ b/lib/private/Files/Storage/Wrapper/Encryption.php @@ -694,7 +694,16 @@ class Encryption extends Wrapper { 'encrypted' => $isEncrypted, ]; if ($isEncrypted) { - $encryptedVersion = $sourceStorage->getCache()->get($sourceInternalPath)['encryptedVersion']; + $sourceCacheEntry = $sourceStorage->getCache()->get($sourceInternalPath); + $targetCacheEntry = $this->getCache()->get($targetInternalPath); + + // Rename of the cache already happened, so we do the cleanup on the target + if ($sourceCacheEntry === false && $targetCacheEntry !== false) { + $encryptedVersion = $targetCacheEntry['encryptedVersion']; + $isRename = false; + } else { + $encryptedVersion = $sourceCacheEntry['encryptedVersion']; + } // In case of a move operation from an unencrypted to an encrypted // storage the old encrypted version would stay with "0" while the |