summaryrefslogtreecommitdiffstats
path: root/lib/private/connector
diff options
context:
space:
mode:
authorThomas Müller <thomas.mueller@tmit.eu>2013-10-25 13:20:59 +0200
committerThomas Müller <thomas.mueller@tmit.eu>2013-10-25 13:20:59 +0200
commitc455cb989b8aa5c69192f825c9815058d00ba693 (patch)
tree92f3ac8aa732fef4ee3255a161cf93871d5471f5 /lib/private/connector
parent3bca1519ee02439e69c1f3191d5185ff462bf782 (diff)
downloadnextcloud-server-c455cb989b8aa5c69192f825c9815058d00ba693.tar.gz
nextcloud-server-c455cb989b8aa5c69192f825c9815058d00ba693.zip
add header 'OC-FileId' on PUT
Diffstat (limited to 'lib/private/connector')
-rw-r--r--lib/private/connector/sabre/filesplugin.php16
1 files changed, 16 insertions, 0 deletions
diff --git a/lib/private/connector/sabre/filesplugin.php b/lib/private/connector/sabre/filesplugin.php
index ac781825672..89444cb8d18 100644
--- a/lib/private/connector/sabre/filesplugin.php
+++ b/lib/private/connector/sabre/filesplugin.php
@@ -40,6 +40,8 @@ class OC_Connector_Sabre_FilesPlugin extends Sabre_DAV_ServerPlugin
$this->server = $server;
$this->server->subscribeEvent('beforeGetProperties', array($this, 'beforeGetProperties'));
+ $this->server->subscribeEvent('afterCreateFile', array($this, 'sendFileIdHeader'));
+ $this->server->subscribeEvent('afterWriteContent', array($this, 'sendFileIdHeader'));
}
/**
@@ -70,4 +72,18 @@ class OC_Connector_Sabre_FilesPlugin extends Sabre_DAV_ServerPlugin
}
+ /**
+ * @param $filePath
+ * @param Sabre_DAV_INode $node
+ * @throws Sabre_DAV_Exception_BadRequest
+ */
+ public function sendFileIdHeader($filePath, Sabre_DAV_INode $node = null) {
+ if ($node instanceof OC_Connector_Sabre_Node) {
+ $fileId = $node->getFileId();
+ if (!is_null($fileId)) {
+ $this->server->httpResponse->setHeader('OC-FileId', $fileId);
+ }
+ }
+ }
+
}