Skip to content

Commit 70f1b3b

Browse files
rhtottsdicloud
authored andcommitted
Combine the check for API calls as from MagentaCLOUD prod and NC E2E test
1 parent ab27e95 commit 70f1b3b

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

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

0 commit comments

Comments
 (0)