Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorThomas Müller <thomas.mueller@tmit.eu>2013-11-04 16:30:12 +0400
committerThomas Müller <thomas.mueller@tmit.eu>2013-11-04 16:30:12 +0400
commitc3898061a8e8026ea608d5c79f597adf4cacc96c (patch)
treed84d20c161327518a8e5ffac134a200734edf010 /lib
parent26ecf2062c7a191f3cb85e5046eba2b10efa0821 (diff)
parentc455cb989b8aa5c69192f825c9815058d00ba693 (diff)
Merge pull request #5544 from owncloud/fixing-3593-2-master
Add FileId header and switch fileid and instance id
Diffstat (limited to 'lib')
-rw-r--r--lib/private/connector/sabre/filesplugin.php16
-rw-r--r--lib/private/connector/sabre/node.php2
2 files changed, 17 insertions, 1 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);
+ }
+ }
+ }
+
}
diff --git a/lib/private/connector/sabre/node.php b/lib/private/connector/sabre/node.php
index 76fbc251100..993aa73faeb 100644
--- a/lib/private/connector/sabre/node.php
+++ b/lib/private/connector/sabre/node.php
@@ -276,7 +276,7 @@ abstract class OC_Connector_Sabre_Node implements Sabre_DAV_INode, Sabre_DAV_IPr
if (isset($this->fileinfo_cache['fileid'])) {
$instanceId = OC_Util::getInstanceId();
$id = sprintf('%08d', $this->fileinfo_cache['fileid']);
- return $instanceId . $id;
+ return $id . $instanceId;
}
return null;