Skip to content

Commit

Permalink
Merge pull request #606 from nextcloud/fix/wopi-session-user
Browse files Browse the repository at this point in the history
chore: Switch to new API to set volatile user to prevent persisting it in any case
  • Loading branch information
juliusknorr authored Dec 19, 2024
2 parents 95ccc6c + a8812d5 commit f13040b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
3 changes: 1 addition & 2 deletions lib/Controller/WopiController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down
7 changes: 6 additions & 1 deletion lib/Service/UserScopeService.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}

/**
Expand Down

0 comments on commit f13040b

Please sign in to comment.