Skip to content

Commit f13040b

Browse files
authored
Merge pull request #606 from nextcloud/fix/wopi-session-user
chore: Switch to new API to set volatile user to prevent persisting it in any case
2 parents 95ccc6c + a8812d5 commit f13040b

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

lib/Controller/WopiController.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -295,8 +295,7 @@ public function getFile($fileId,
295295

296296
try {
297297
/** @var File $file */
298-
$userFolder = $this->rootFolder->getUserFolder($wopi->getOwnerUid());
299-
$file = $userFolder->getById($fileId)[0];
298+
$file = $this->getFileForWopiToken($wopi);
300299
\OC_User::setIncognitoMode(true);
301300
if ($version !== '0') {
302301
$view = new View('/' . $wopi->getOwnerUid() . '/files');

lib/Service/UserScopeService.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,12 @@ public function setUserScope(?string $uid = null) {
3131
if ($user === null) {
3232
throw new \InvalidArgumentException('No user found for the uid ' . $uid);
3333
}
34-
$this->userSession->setUser($user);
34+
35+
if (method_exists($this->userSession, 'setVolatileActiveUser')) {
36+
$this->userSession->setVolatileActiveUser($user);
37+
} else {
38+
$this->userSession->setUser($user);
39+
}
3540
}
3641

3742
/**

0 commit comments

Comments
 (0)