Skip to content

Commit 424c534

Browse files
rhtotsgyuris
authored andcommitted
Combine the check for API calls as from MagentaCLOUD prod and NC E2E test
1 parent a6c1b98 commit 424c534

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

lib/base.php

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -430,13 +430,14 @@ public static function initSession(): void {
430430
// TODO: Temporary disabled again to solve issues with CalDAV/CardDAV clients like DAVx5 that use cookies
431431
// TODO: See https://github.com/nextcloud/server/issues/37277#issuecomment-1476366147 and the other comments
432432
// TODO: for further information.
433-
// $isDavRequest = strpos($request->getRequestUri(), '/remote.php/dav') === 0 || strpos($request->getRequestUri(), '/remote.php/webdav') === 0;
434-
// if ($request->getHeader('Authorization') !== '' && is_null($request->getCookie('cookie_test')) && $isDavRequest && !isset($_COOKIE['nc_session_id'])) {
435-
// setcookie('cookie_test', 'test', time() + 3600);
436-
// // Do not initialize the session if a request is authenticated directly
437-
// // unless there is a session cookie already sent along
438-
// return;
439-
// }
433+
// MagentaCLOUD stays with original version of the solution from production
434+
$isDavRequest = strpos($request->getRequestUri(), '/remote.php/dav') === 0 ||
435+
strpos($request->getRequestUri(), '/remote.php/webdav') === 0;
436+
if ($request->getHeader('Authorization') !== '' && $isDavRequest && !isset($_COOKIE['nc_session_id'])) {
437+
// Do not initialize the session if a request is authenticated directly
438+
// unless there is a session cookie already sent along
439+
return;
440+
}
440441

441442
if ($request->getServerProtocol() === 'https') {
442443
ini_set('session.cookie_secure', 'true');

0 commit comments

Comments
 (0)