File tree 1 file changed +17
-2
lines changed 1 file changed +17
-2
lines changed Original file line number Diff line number Diff line change 66
66
use OCP \EventDispatcher \IEventDispatcher ;
67
67
use OCP \Group \Events \UserRemovedEvent ;
68
68
use OCP \ILogger ;
69
+ use OCP \IRequest ;
69
70
use OCP \Server ;
70
71
use OCP \Share ;
71
72
use OC \Encryption \HookManager ;
@@ -414,8 +415,22 @@ private static function printUpgradePage(\OC\SystemConfig $systemConfig) {
414
415
$ tmpl ->printPage ();
415
416
}
416
417
417
- public static function initSession () {
418
- if (self ::$ server ->getRequest ()->getServerProtocol () === 'https ' ) {
418
+ public static function initSession (): void {
419
+ $ request = Server::get (IRequest::class);
420
+
421
+ // TODO: Temporary disabled again to solve issues with CalDAV/CardDAV clients like DAVx5 that use cookies
422
+ // TODO: See https://github.com/nextcloud/server/issues/37277#issuecomment-1476366147 and the other comments
423
+ // TODO: for further information.
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
+ }
432
+
433
+ if ($ request ->getServerProtocol () === 'https ' ) {
419
434
ini_set ('session.cookie_secure ' , 'true ' );
420
435
}
421
436
You can’t perform that action at this time.
0 commit comments