aboutsummaryrefslogtreecommitdiffstats
path: root/apps/dav
diff options
context:
space:
mode:
authorStephan Orbaugh <62374139+sorbaugh@users.noreply.github.com>2024-10-10 09:28:56 +0200
committerGitHub <noreply@github.com>2024-10-10 09:28:56 +0200
commitbb4d0c7a2572b842da670721ce98bafbe79bc1a8 (patch)
tree91ef361db89245fb2860db1e8b3da9312bf518a0 /apps/dav
parent39bae6f32591036be1674b58a355d71303a44790 (diff)
parentb79d2b7041ba7e74769bd2c37a0330d9974e5872 (diff)
downloadnextcloud-server-bb4d0c7a2572b842da670721ce98bafbe79bc1a8.tar.gz
nextcloud-server-bb4d0c7a2572b842da670721ce98bafbe79bc1a8.zip
Merge pull request #48630 from nextcloud/backport/48628/stable30
[stable30] fix(dav): Public WebDAV endpoint should allow `GET` requests
Diffstat (limited to 'apps/dav')
-rw-r--r--apps/dav/appinfo/v2/publicremote.php16
1 files changed, 10 insertions, 6 deletions
diff --git a/apps/dav/appinfo/v2/publicremote.php b/apps/dav/appinfo/v2/publicremote.php
index 53e85d556eb..0b7480872cb 100644
--- a/apps/dav/appinfo/v2/publicremote.php
+++ b/apps/dav/appinfo/v2/publicremote.php
@@ -73,11 +73,15 @@ 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 = 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
- throw new NotAuthenticated();
+ // GET must be allowed for e.g. showing images and allowing Zip downloads
+ if ($server->httpRequest->getMethod() !== 'GET') {
+ // If this is *not* a GET request we only allow access to public DAV from AJAX or when Server2Server is allowed
+ $isAjax = in_array('XMLHttpRequest', explode(',', $_SERVER['HTTP_X_REQUESTED_WITH'] ?? ''));
+ $federatedShareProvider = \OCP\Server::get(FederatedShareProvider::class);
+ if ($federatedShareProvider->isOutgoingServer2serverShareEnabled() === false && $isAjax === false) {
+ // this is what is thrown when trying to access a non-existing share
+ throw new NotAuthenticated();
+ }
}
$share = $authBackend->getShare();
@@ -132,4 +136,4 @@ $server->addPlugin($linkCheckPlugin);
$server->addPlugin($filesDropPlugin);
// And off we go!
-$server->exec();
+$server->start();