Commit ae50e723 authored by Vincent Petry's avatar Vincent Petry Committed by GitHub
Browse files

Merge pull request #25225 from owncloud/enc-revertversionsize

Rollback version must also adjust cached size
parents d5f43288 fa3dc909
......@@ -336,9 +336,16 @@ class Storage {
// Restore encrypted version of the old file for the newly restored file
// This has to happen manually here since the file is manually copied below
$oldVersion = $users_view->getFileInfo($fileToRestore)->getEncryptedVersion();
$oldFileInfo = $users_view->getFileInfo($fileToRestore);
$newFileInfo = $files_view->getFileInfo($filename);
$cache = $newFileInfo->getStorage()->getCache();
$cache->update($newFileInfo->getId(), ['encrypted' => $oldVersion, 'encryptedVersion' => $oldVersion]);
$cache->update(
$newFileInfo->getId(), [
'encrypted' => $oldVersion,
'encryptedVersion' => $oldVersion,
'size' => $oldFileInfo->getSize()
]
);
// rollback
if (self::copyFileContents($users_view, $fileToRestore, 'files' . $filename)) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment