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:
authorJonas Meurer <jonas@freesources.org>2022-01-12 17:28:34 +0300
committerJonas Meurer <jonas@freesources.org>2022-01-15 15:40:01 +0300
commit5d1157c37c086694fb9af1572fcf584743086043 (patch)
tree0b1c8888b197f3a79aa80e8f91c46afb1f080437
parent5881082fd8036f879067d5188213d7ca9c40493f (diff)
updateEncryptedVersion: cleanup on target if cache already got renamed
When moving a file to trash with encryption enabled, the cache gets moved before the actual file. According to @icewind1991 this is in order to not break object storage. When moving a file from an unencrypted storage (e.g. a collectives storage) to the encrypted trashbin storage, this causes errors, see This commit fixes it by doing `updateEncryptedVersion()` on the target cache entry *if* the source cache entry doesn't exist anymore, but the corresponding target cache entry does exist already. Fixes: #26544 Signed-off-by: Jonas Meurer <jonas@freesources.org>
-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 cb09a4fde7a..533edb9e487 100644
--- a/lib/private/Files/Storage/Wrapper/Encryption.php
+++ b/lib/private/Files/Storage/Wrapper/Encryption.php
@@ -666,7 +666,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