diff --git a/lib/Controller/WopiController.php b/lib/Controller/WopiController.php index fe86f8f5..5635a6c1 100755 --- a/lib/Controller/WopiController.php +++ b/lib/Controller/WopiController.php @@ -295,8 +295,7 @@ public function getFile($fileId, try { /** @var File $file */ - $userFolder = $this->rootFolder->getUserFolder($wopi->getOwnerUid()); - $file = $userFolder->getById($fileId)[0]; + $file = $this->getFileForWopiToken($wopi); \OC_User::setIncognitoMode(true); if ($version !== '0') { $view = new View('/' . $wopi->getOwnerUid() . '/files'); diff --git a/lib/Service/UserScopeService.php b/lib/Service/UserScopeService.php index a9c7b0d2..b6e5683c 100644 --- a/lib/Service/UserScopeService.php +++ b/lib/Service/UserScopeService.php @@ -31,7 +31,12 @@ public function setUserScope(?string $uid = null) { if ($user === null) { throw new \InvalidArgumentException('No user found for the uid ' . $uid); } - $this->userSession->setUser($user); + + if (method_exists($this->userSession, 'setVolatileActiveUser')) { + $this->userSession->setVolatileActiveUser($user); + } else { + $this->userSession->setUser($user); + } } /**