From 4df256a90839675116984f1ffbbc09515e50dcfa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julius=20H=C3=A4rtl?= Date: Thu, 25 Jul 2024 11:12:45 +0200 Subject: [PATCH 1/2] chore: Switch to new API to set volatile user to prevent persisting it in any case MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Julius Härtl --- lib/Service/UserScopeService.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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); + } } /** From a8812d5b9f9a105f00ee17554a3c1dbfea081bcc Mon Sep 17 00:00:00 2001 From: Julius Knorr Date: Thu, 19 Dec 2024 12:38:01 +0100 Subject: [PATCH 2/2] fix: Use proper method to get file Signed-off-by: Julius Knorr --- lib/Controller/WopiController.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) 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');