]> source.dussan.org Git - nextcloud-server.git/commitdiff
fix(dav): ajax request check on public remote endpoints 42853/head
authorJohn Molakvoæ <skjnldsv@protonmail.com>
Tue, 16 Jan 2024 16:31:26 +0000 (17:31 +0100)
committerJohn Molakvoæ <skjnldsv@users.noreply.github.com>
Wed, 17 Jan 2024 08:05:11 +0000 (09:05 +0100)
Signed-off-by: John Molakvoæ <skjnldsv@protonmail.com>
apps/dav/appinfo/v1/publicwebdav.php
apps/dav/appinfo/v2/publicremote.php

index b5a88afb16ea36edd1eb80d9cfebaaef17101b2b..8aa084a1114b35ff83de8cffa60e6096e1cb417c 100644 (file)
@@ -73,7 +73,7 @@ $linkCheckPlugin = new \OCA\DAV\Files\Sharing\PublicLinkCheckPlugin();
 $filesDropPlugin = new \OCA\DAV\Files\Sharing\FilesDropPlugin();
 
 $server = $serverFactory->createServer($baseuri, $requestUri, $authPlugin, function (\Sabre\DAV\Server $server) use ($authBackend, $linkCheckPlugin, $filesDropPlugin) {
-       $isAjax = (isset($_SERVER['HTTP_X_REQUESTED_WITH']) && $_SERVER['HTTP_X_REQUESTED_WITH'] === 'XMLHttpRequest');
+       $isAjax = in_array('XMLHttpRequest', explode(',', $_SERVER['HTTP_X_REQUESTED_WITH'] ?? ''));
        /** @var \OCA\FederatedFileSharing\FederatedShareProvider $shareProvider */
        $federatedShareProvider = \OC::$server->query(\OCA\FederatedFileSharing\FederatedShareProvider::class);
        if ($federatedShareProvider->isOutgoingServer2serverShareEnabled() === false && !$isAjax) {
index 0ef9bda8ddabca61f048c462c29ff610d5079ccf..0381614a328890ffc5788bb1e04618ff82803a18 100644 (file)
@@ -96,7 +96,7 @@ preg_match('/(^files\/\w+)/i', substr($requestUri, strlen($baseuri)), $match);
 $baseuri = $baseuri . $match[0];
 
 $server = $serverFactory->createServer($baseuri, $requestUri, $authPlugin, function (\Sabre\DAV\Server $server) use ($authBackend, $linkCheckPlugin, $filesDropPlugin) {
-       $isAjax = (isset($_SERVER['HTTP_X_REQUESTED_WITH']) && $_SERVER['HTTP_X_REQUESTED_WITH'] === 'XMLHttpRequest');
+       $isAjax = in_array('XMLHttpRequest', explode(',', $_SERVER['HTTP_X_REQUESTED_WITH'] ?? ''));
        $federatedShareProvider = \OCP\Server::get(FederatedShareProvider::class);
        if ($federatedShareProvider->isOutgoingServer2serverShareEnabled() === false && !$isAjax) {
                // this is what is thrown when trying to access a non-existing share