Skip to content

Commit 5ebf724

Browse files
rhtotsgyuris
authored andcommitted
Combine the check for API calls as from MagentaCLOUD prod and NC E2E test
1 parent bb6c57f commit 5ebf724

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
@@ -425,13 +425,14 @@ public static function initSession(): void {
425425
// TODO: Temporary disabled again to solve issues with CalDAV/CardDAV clients like DAVx5 that use cookies
426426
// TODO: See https://github.com/nextcloud/server/issues/37277#issuecomment-1476366147 and the other comments
427427
// TODO: for further information.
428-
// $isDavRequest = strpos($request->getRequestUri(), '/remote.php/dav') === 0 || strpos($request->getRequestUri(), '/remote.php/webdav') === 0;
429-
// if ($request->getHeader('Authorization') !== '' && is_null($request->getCookie('cookie_test')) && $isDavRequest && !isset($_COOKIE['nc_session_id'])) {
430-
// setcookie('cookie_test', 'test', time() + 3600);
431-
// // Do not initialize the session if a request is authenticated directly
432-
// // unless there is a session cookie already sent along
433-
// return;
434-
// }
428+
// MagentaCLOUD stays with original version of the solution from production
429+
$isDavRequest = strpos($request->getRequestUri(), '/remote.php/dav') === 0 ||
430+
strpos($request->getRequestUri(), '/remote.php/webdav') === 0;
431+
if ($request->getHeader('Authorization') !== '' && $isDavRequest && !isset($_COOKIE['nc_session_id'])) {
432+
// Do not initialize the session if a request is authenticated directly
433+
// unless there is a session cookie already sent along
434+
return;
435+
}
435436

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

0 commit comments

Comments
 (0)