Skip to content

Commit a558c30

Browse files
committed
fix(dav): ajax request check on public remote endpoints
Signed-off-by: John Molakvoæ <[email protected]>
1 parent 8584976 commit a558c30

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

apps/dav/appinfo/v1/publicwebdav.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@
7373
$filesDropPlugin = new \OCA\DAV\Files\Sharing\FilesDropPlugin();
7474

7575
$server = $serverFactory->createServer($baseuri, $requestUri, $authPlugin, function (\Sabre\DAV\Server $server) use ($authBackend, $linkCheckPlugin, $filesDropPlugin) {
76-
$isAjax = (isset($_SERVER['HTTP_X_REQUESTED_WITH']) && $_SERVER['HTTP_X_REQUESTED_WITH'] === 'XMLHttpRequest');
76+
$isAjax = in_array('XMLHttpRequest', explode(',', $_SERVER['HTTP_X_REQUESTED_WITH'] ?? ''));
7777
/** @var \OCA\FederatedFileSharing\FederatedShareProvider $shareProvider */
7878
$federatedShareProvider = \OC::$server->query(\OCA\FederatedFileSharing\FederatedShareProvider::class);
7979
if ($federatedShareProvider->isOutgoingServer2serverShareEnabled() === false && !$isAjax) {

apps/dav/appinfo/v2/publicremote.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@
9696
$baseuri = $baseuri . $match[0];
9797

9898
$server = $serverFactory->createServer($baseuri, $requestUri, $authPlugin, function (\Sabre\DAV\Server $server) use ($authBackend, $linkCheckPlugin, $filesDropPlugin) {
99-
$isAjax = (isset($_SERVER['HTTP_X_REQUESTED_WITH']) && $_SERVER['HTTP_X_REQUESTED_WITH'] === 'XMLHttpRequest');
99+
$isAjax = in_array('XMLHttpRequest', explode(',', $_SERVER['HTTP_X_REQUESTED_WITH'] ?? ''));
100100
$federatedShareProvider = \OCP\Server::get(FederatedShareProvider::class);
101101
if ($federatedShareProvider->isOutgoingServer2serverShareEnabled() === false && !$isAjax) {
102102
// this is what is thrown when trying to access a non-existing share

0 commit comments

Comments
 (0)