Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichaIng <micha@dietpi.com>2022-01-15 04:48:12 +0300
committerGitHub <noreply@github.com>2022-01-15 04:48:12 +0300
commit9f7c05cf4f159e8547e56499562ba4892214078c (patch)
tree01b39642d8d1582ebaa795e60d627f873a15b179
parent5bebac3ab2e646b4d8fa83ac3dd233f1a8e5ff6e (diff)
parent9da4620ff8240b4a4528b54e00f76b3ec73a80c6 (diff)
Merge pull request #30695 from nextcloud/backport/30631/stable23
[stable23] updateEncryptedVersion: cleanup on target if cache already got renamed
-rw-r--r--lib/private/Files/Storage/Wrapper/Encryption.php11
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