summaryrefslogtreecommitdiffstats
path: root/apps/dav/lib
diff options
context:
space:
mode:
Diffstat (limited to 'apps/dav/lib')
-rw-r--r--apps/dav/lib/Connector/Sabre/CopyEtagHeaderPlugin.php26
-rw-r--r--apps/dav/lib/Server.php17
2 files changed, 37 insertions, 6 deletions
diff --git a/apps/dav/lib/Connector/Sabre/CopyEtagHeaderPlugin.php b/apps/dav/lib/Connector/Sabre/CopyEtagHeaderPlugin.php
index b8f55d9e213..a39a3d29779 100644
--- a/apps/dav/lib/Connector/Sabre/CopyEtagHeaderPlugin.php
+++ b/apps/dav/lib/Connector/Sabre/CopyEtagHeaderPlugin.php
@@ -32,6 +32,9 @@ use \Sabre\HTTP\ResponseInterface;
* or mangle Etag headers.
*/
class CopyEtagHeaderPlugin extends \Sabre\DAV\ServerPlugin {
+
+ /** @var \Sabre\DAV\Server */
+ private $server;
/**
* This initializes the plugin.
*
@@ -40,7 +43,10 @@ class CopyEtagHeaderPlugin extends \Sabre\DAV\ServerPlugin {
* @return void
*/
public function initialize(\Sabre\DAV\Server $server) {
- $server->on('afterMethod', array($this, 'afterMethod'));
+ $this->server = $server;
+
+ $server->on('afterMethod', [$this, 'afterMethod']);
+ $server->on('afterMove', [$this, 'afterMove']);
}
/**
@@ -55,4 +61,22 @@ class CopyEtagHeaderPlugin extends \Sabre\DAV\ServerPlugin {
$response->setHeader('OC-ETag', $eTag);
}
}
+
+ /**
+ * Called after a node is moved.
+ *
+ * This allows the backend to move all the associated properties.
+ *
+ * @param string $source
+ * @param string $destination
+ * @return void
+ */
+ function afterMove($source, $destination) {
+ $node = $this->server->tree->getNodeForPath($destination);
+ if ($node instanceof File) {
+ $eTag = $node->getETag();
+ $this->server->httpResponse->setHeader('OC-ETag', $eTag);
+ $this->server->httpResponse->setHeader('ETag', $eTag);
+ }
+ }
}
diff --git a/apps/dav/lib/Server.php b/apps/dav/lib/Server.php
index d67417a10d5..c49df197a89 100644
--- a/apps/dav/lib/Server.php
+++ b/apps/dav/lib/Server.php
@@ -30,14 +30,19 @@ namespace OCA\DAV;
use OCA\DAV\CalDAV\Schedule\IMipPlugin;
use OCA\DAV\CardDAV\ImageExportPlugin;
+use OCA\DAV\Comments\CommentsPlugin;
use OCA\DAV\Connector\Sabre\Auth;
use OCA\DAV\Connector\Sabre\BlockLegacyClientPlugin;
+use OCA\DAV\Connector\Sabre\CopyEtagHeaderPlugin;
use OCA\DAV\Connector\Sabre\DavAclPlugin;
use OCA\DAV\Connector\Sabre\DummyGetResponsePlugin;
+use OCA\DAV\Connector\Sabre\FakeLockerPlugin;
use OCA\DAV\Connector\Sabre\FilesPlugin;
use OCA\DAV\DAV\PublicAuth;
+use OCA\DAV\Connector\Sabre\QuotaPlugin;
use OCA\DAV\Files\BrowserErrorPagePlugin;
use OCA\DAV\Files\CustomPropertiesBackend;
+use OCA\DAV\SystemTag\SystemTagPlugin;
use OCP\IRequest;
use OCP\SabrePluginEvent;
use Sabre\CardDAV\VCFExportPlugin;
@@ -128,25 +133,27 @@ class Server {
$this->server->addPlugin(new ImageExportPlugin(\OC::$server->getLogger()));
// system tags plugins
- $this->server->addPlugin(new \OCA\DAV\SystemTag\SystemTagPlugin(
+ $this->server->addPlugin(new SystemTagPlugin(
\OC::$server->getSystemTagManager(),
\OC::$server->getGroupManager(),
\OC::$server->getUserSession()
));
// comments plugin
- $this->server->addPlugin(new \OCA\DAV\Comments\CommentsPlugin(
+ $this->server->addPlugin(new CommentsPlugin(
\OC::$server->getCommentsManager(),
\OC::$server->getUserSession()
));
+ $this->server->addPlugin(new CopyEtagHeaderPlugin());
+
// Some WebDAV clients do require Class 2 WebDAV support (locking), since
// we do not provide locking we emulate it using a fake locking plugin.
if($request->isUserAgent([
'/WebDAVFS/',
'/Microsoft Office OneNote 2013/',
])) {
- $this->server->addPlugin(new \OCA\DAV\Connector\Sabre\FakeLockerPlugin());
+ $this->server->addPlugin(new FakeLockerPlugin());
}
if (BrowserErrorPagePlugin::isBrowserRequest($request)) {
@@ -181,8 +188,8 @@ class Server {
)
);
$this->server->addPlugin(
- new \OCA\DAV\Connector\Sabre\QuotaPlugin($view));
-
+ new QuotaPlugin($view)
+ );
}
});
}