From 880ff122f11b51585d115892b8ba79b6900237bd Mon Sep 17 00:00:00 2001 From: Vincent Petry Date: Wed, 22 Jun 2016 15:18:19 +0200 Subject: [PATCH] Rollback version must also adjust cached size --- apps/files_versions/lib/storage.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/apps/files_versions/lib/storage.php b/apps/files_versions/lib/storage.php index a1069410e7..1062f49cf6 100644 --- a/apps/files_versions/lib/storage.php +++ b/apps/files_versions/lib/storage.php @@ -337,9 +337,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)) {