]> source.dussan.org Git - nextcloud-server.git/commitdiff
Show a empty response for GET on non-files instead of the Browser Plugin
authorLukas Reschke <lukas@owncloud.com>
Wed, 18 Feb 2015 12:41:42 +0000 (13:41 +0100)
committerThomas Müller <thomas.mueller@tmit.eu>
Mon, 23 Feb 2015 21:27:23 +0000 (22:27 +0100)
apps/files/appinfo/remote.php
lib/private/connector/sabre/dummygetresponseplugin.php [new file with mode: 0644]

index 98db95041fecfbb4edeb8e58ec16e01c48fc035d..e4a105b6d28dc934fae2164df0650c818ec5c49d 100644 (file)
@@ -41,7 +41,8 @@ $server->setBaseUri($baseuri);
 $defaults = new OC_Defaults();
 $server->addPlugin(new \Sabre\DAV\Auth\Plugin($authBackend, $defaults->getName()));
 $server->addPlugin(new \Sabre\DAV\Locks\Plugin($lockBackend));
-$server->addPlugin(new \Sabre\DAV\Browser\Plugin(false, false)); // Show something in the Browser, but no upload
+// FIXME: The following line is a workaround for legacy components relying on being able to send a GET to /
+$server->addPlugin(new \OC\Connector\Sabre\DummyGetResponsePlugin());
 $server->addPlugin(new \OC\Connector\Sabre\FilesPlugin($objectTree));
 $server->addPlugin(new \OC\Connector\Sabre\MaintenancePlugin());
 $server->addPlugin(new \OC\Connector\Sabre\ExceptionLoggerPlugin('webdav'));
diff --git a/lib/private/connector/sabre/dummygetresponseplugin.php b/lib/private/connector/sabre/dummygetresponseplugin.php
new file mode 100644 (file)
index 0000000..0b78fe7
--- /dev/null
@@ -0,0 +1,43 @@
+<?php
+/**
+ * Copyright (c) 2015 Lukas Reschke <lukas@owncloud.com>
+ * This file is licensed under the Affero General Public License version 3 or
+ * later.
+ * See the COPYING-README file.
+ */
+
+namespace OC\Connector\Sabre;
+
+/**
+ * Class DummyGetResponsePlugin is a plugin used to not show a "Not implemented"
+ * error to clients that rely on verifying the functionality of the ownCloud
+ * WebDAV backend using a simple GET to /.
+ *
+ * This is considered a legacy behaviour and implementers should consider sending
+ * a PROPFIND request instead to verify whether the WebDAV component is working
+ * properly.
+ *
+ * FIXME: Remove once clients are all compliant.
+ *
+ * @package OC\Connector\Sabre
+ */
+class DummyGetResponsePlugin extends \Sabre\DAV\ServerPlugin {
+       /** @var \Sabre\DAV\Server */
+       protected $server;
+
+       /**
+        * @param \Sabre\DAV\Server $server
+        * @return void
+        */
+       function initialize(\Sabre\DAV\Server  $server) {
+               $this->server = $server;
+               $this->server->on('method:GET', [$this,'httpGet'], 200);
+       }
+
+       /**
+        * @return false
+        */
+       function httpGet() {
+               return false;
+       }
+}