summaryrefslogtreecommitdiffstats
path: root/apps/dav
diff options
context:
space:
mode:
authorThomas Citharel <tcit@tcit.fr>2016-07-11 16:10:25 +0200
committerLukas Reschke <lukas@statuscode.ch>2016-09-26 11:55:36 +0200
commit994001c4804f214a340922467a8ea96ec96a227e (patch)
tree602ae96ec3cf01fb1ba46cfa0eb8d8deb4e60eee /apps/dav
parent00dc157b19834cfe558bc25a105cc509f47d7ed6 (diff)
downloadnextcloud-server-994001c4804f214a340922467a8ea96ec96a227e.tar.gz
nextcloud-server-994001c4804f214a340922467a8ea96ec96a227e.zip
Dirty hack to disable dav plugins on public calendar urls
Diffstat (limited to 'apps/dav')
-rw-r--r--apps/dav/lib/CalDAV/Publishing/PublishPlugin.php20
1 files changed, 20 insertions, 0 deletions
diff --git a/apps/dav/lib/CalDAV/Publishing/PublishPlugin.php b/apps/dav/lib/CalDAV/Publishing/PublishPlugin.php
index 1d45aef5a2f..109e1158555 100644
--- a/apps/dav/lib/CalDAV/Publishing/PublishPlugin.php
+++ b/apps/dav/lib/CalDAV/Publishing/PublishPlugin.php
@@ -91,6 +91,7 @@ class PublishPlugin extends ServerPlugin
$this->server->on('method:POST', [$this, 'httpPost']);
$this->server->on('propFind', [$this, 'propFind']);
+ $this->server->on('method:OPTIONS', [$this, 'httpOptions'], 5);
}
public function propFind(PropFind $propFind, INode $node)
@@ -209,4 +210,23 @@ class PublishPlugin extends ServerPlugin
}
}
+
+ public function httpOptions(RequestInterface $request, ResponseInterface $response) {
+ if ($request->getPath() == 'public-calendars') {
+ $methods = $this->server->getAllowedMethods($request->getPath());
+
+ $response->setHeader('Allow', strtoupper(implode(', ', $methods)));
+ $features = ['1', '3', 'extended-mkcol'];
+
+ $response->setHeader('DAV', implode(', ', $features));
+ $response->setHeader('MS-Author-Via', 'DAV');
+ $response->setHeader('Accept-Ranges', 'bytes');
+ $response->setHeader('Content-Length', '0');
+ $response->setStatus(200);
+
+ // Sending back false will interupt the event chain and tell the server
+ // we've handled this method.
+ return false;
+ }
+ }
}