diff --git a/lib/Controller/WopiController.php b/lib/Controller/WopiController.php index a9cf99ac26..592ae6e290 100644 --- a/lib/Controller/WopiController.php +++ b/lib/Controller/WopiController.php @@ -386,9 +386,8 @@ public function getFile($fileId, $file = $this->getFileForWopiToken($wopi); \OC_User::setIncognitoMode(true); if ($version !== '0') { - $userFolder = $this->rootFolder->getUserFolder($wopi->getOwnerUid()); $versionManager = \OC::$server->get(IVersionManager::class); - $info = $versionManager->getVersionFile($userFolder->getOwner(), $file, $version); + $info = $versionManager->getVersionFile($this->userManager->get($wopi->getUserForFileAccess()), $file, $version); if ($info->getSize() === 0) { $response = new Http\Response(); } else {