diff options
author | Lukas Reschke <lukas@owncloud.com> | 2016-03-10 15:58:24 +0100 |
---|---|---|
committer | Lukas Reschke <lukas@owncloud.com> | 2016-03-16 10:36:15 +0100 |
commit | 676041ba7edaf668c9e6c1bb6f1c25ff7635960a (patch) | |
tree | 31abdb75eaecc7f8552f742b9c0378d69867e820 /lib | |
parent | 631ae2f0f4eda0da1c03bfc1a9a32e8cf7a926a7 (diff) | |
download | nextcloud-server-676041ba7edaf668c9e6c1bb6f1c25ff7635960a.tar.gz nextcloud-server-676041ba7edaf668c9e6c1bb6f1c25ff7635960a.zip |
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.php | 13 |
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 |