mirror of
https://github.com/nextcloud/server.git
synced 2026-05-28 04:32:30 -04:00
Merge pull request #58144 from nextcloud/fix/more-missing-userid-cases
fix: add missing `X-User-Id` in DAV uploads and index redirect
This commit is contained in:
commit
238e459032
2 changed files with 5 additions and 3 deletions
|
|
@ -19,7 +19,7 @@ class UserIdHeaderPlugin extends \Sabre\DAV\ServerPlugin {
|
|||
}
|
||||
|
||||
public function initialize(\Sabre\DAV\Server $server): void {
|
||||
$server->on('afterMethod:*', [$this, 'afterMethod']);
|
||||
$server->on('beforeMethod:*', [$this, 'beforeMethod']);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -28,7 +28,7 @@ class UserIdHeaderPlugin extends \Sabre\DAV\ServerPlugin {
|
|||
* @param RequestInterface $request request
|
||||
* @param ResponseInterface $response response
|
||||
*/
|
||||
public function afterMethod(RequestInterface $request, ResponseInterface $response): void {
|
||||
public function beforeMethod(RequestInterface $request, ResponseInterface $response): void {
|
||||
if ($user = $this->userSession->getUser()) {
|
||||
$response->setHeader('X-User-Id', $user->getUID());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1190,7 +1190,9 @@ class OC {
|
|||
// Redirect to the default app or login only as an entry point
|
||||
if ($requestPath === '') {
|
||||
// Someone is logged in
|
||||
if (Server::get(IUserSession::class)->isLoggedIn()) {
|
||||
$userSession = Server::get(IUserSession::class);
|
||||
if ($userSession->isLoggedIn()) {
|
||||
header('X-User-Id: ' . $userSession->getUser()?->getUID());
|
||||
header('Location: ' . Server::get(IURLGenerator::class)->linkToDefaultPageUrl());
|
||||
} else {
|
||||
// Not handled and not logged in
|
||||
|
|
|
|||
Loading…
Reference in a new issue