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
path: root/lib
diff options
context:
space:
mode:
authorLukas Reschke <lukas@owncloud.com>2016-03-10 17:58:24 +0300
committerLukas Reschke <lukas@owncloud.com>2016-03-16 12:37:41 +0300
commitf9ad57ee523db315e49f08ae4d28b592d32cc8c9 (patch)
tree2315909210d3bee55cc2bf2f16464217ffcf7298 /lib
parentb580d2627075f41b71e73145eefa4cfea4688418 (diff)
Ensure that stored version is at least 1 for cross-storage copy
In case of a move operation from an unencrypted to an encrypted storage the old encrypted version would stay with "0" while the correct value would be "1". Thus we manually set the value to "1" for those cases. See also https://github.com/owncloud/core/issues/23078
Diffstat (limited to 'lib')
-rw-r--r--lib/private/files/storage/wrapper/encryption.php13
1 files changed, 12 insertions, 1 deletions
diff --git a/lib/private/files/storage/wrapper/encryption.php b/lib/private/files/storage/wrapper/encryption.php
index 0b4816174bf..81eea9944f8 100644
--- a/lib/private/files/storage/wrapper/encryption.php
+++ b/lib/private/files/storage/wrapper/encryption.php
@@ -634,7 +634,18 @@ class Encryption extends Wrapper {
'encrypted' => (bool)$isEncrypted,
];
if($isEncrypted === 1) {
- $cacheInformation['encryptedVersion'] = $sourceStorage->getCache()->get($sourceInternalPath)['encryptedVersion'];
+ $encryptedVersion = $sourceStorage->getCache()->get($sourceInternalPath)['encryptedVersion'];
+
+ // In case of a move operation from an unencrypted to an encrypted
+ // storage the old encrypted version would stay with "0" while the
+ // correct value would be "1". Thus we manually set the value to "1"
+ // for those cases.
+ // See also https://github.com/owncloud/core/issues/23078
+ if($encryptedVersion === 0) {
+ $encryptedVersion = 1;
+ }
+
+ $cacheInformation['encryptedVersion'] = $encryptedVersion;
}
// in case of a rename we need to manipulate the source cache because