From 0e944c190d40911188404417cdd19f7a527ded09 Mon Sep 17 00:00:00 2001 From: Salvatore Martire <4652631+salmart-dev@users.noreply.github.com> Date: Fri, 6 Feb 2026 20:24:23 +0100 Subject: [PATCH 1/2] fix(dav): set user id header in response earlier Signed-off-by: Salvatore Martire <4652631+salmart-dev@users.noreply.github.com> --- apps/dav/lib/Connector/Sabre/UserIdHeaderPlugin.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/dav/lib/Connector/Sabre/UserIdHeaderPlugin.php b/apps/dav/lib/Connector/Sabre/UserIdHeaderPlugin.php index 5e0436f97a06c..738e08b615af5 100644 --- a/apps/dav/lib/Connector/Sabre/UserIdHeaderPlugin.php +++ b/apps/dav/lib/Connector/Sabre/UserIdHeaderPlugin.php @@ -19,7 +19,7 @@ public function __construct( } public function initialize(\Sabre\DAV\Server $server): void { - $server->on('afterMethod:*', [$this, 'afterMethod']); + $server->on('beforeMethod:*', [$this, 'beforeMethod']); } /** @@ -28,7 +28,7 @@ public function initialize(\Sabre\DAV\Server $server): void { * @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()); } From 2eecf81833cc2f38d75eedc6d9ee56f4d44fd999 Mon Sep 17 00:00:00 2001 From: Salvatore Martire <4652631+salmart-dev@users.noreply.github.com> Date: Fri, 6 Feb 2026 20:25:20 +0100 Subject: [PATCH 2/2] fix: add user id header when redirecting to default app Signed-off-by: Salvatore Martire <4652631+salmart-dev@users.noreply.github.com> --- lib/base.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/base.php b/lib/base.php index 8676b17e19b48..2884aaea9d539 100644 --- a/lib/base.php +++ b/lib/base.php @@ -1190,7 +1190,9 @@ public static function handleRequest(): void { // 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