diff options
author | Thomas Müller <thomas.mueller@tmit.eu> | 2013-10-25 13:20:59 +0200 |
---|---|---|
committer | Thomas Müller <thomas.mueller@tmit.eu> | 2013-10-25 13:20:59 +0200 |
commit | c455cb989b8aa5c69192f825c9815058d00ba693 (patch) | |
tree | 92f3ac8aa732fef4ee3255a161cf93871d5471f5 /lib/private/connector | |
parent | 3bca1519ee02439e69c1f3191d5185ff462bf782 (diff) | |
download | nextcloud-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.php | 16 |
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); + } + } + } + } |