From 96a931929ea837a40a7e9b836252587c949a8127 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20M=C3=BCller?= Date: Fri, 29 Aug 2014 12:09:33 +0200 Subject: [PATCH] adding OC-ETag header --- lib/private/connector/sabre/file.php | 15 --------------- lib/private/connector/sabre/filesplugin.php | 4 ++++ lib/private/connector/sabre/node.php | 16 ++++++++++++++++ 3 files changed, 20 insertions(+), 15 deletions(-) diff --git a/lib/private/connector/sabre/file.php b/lib/private/connector/sabre/file.php index ece6885f24..44c86e6971 100644 --- a/lib/private/connector/sabre/file.php +++ b/lib/private/connector/sabre/file.php @@ -180,21 +180,6 @@ class OC_Connector_Sabre_File extends OC_Connector_Sabre_Node implements \Sabre\ return $this->info->getSize(); } - /** - * Returns the ETag for a file - * - * An ETag is a unique identifier representing the current version of the - * file. If the file changes, the ETag MUST change. The ETag is an - * arbitrary string, but MUST be surrounded by double-quotes. - * - * Return null if the ETag can not effectively be determined - * - * @return mixed - */ - public function getETag() { - return '"' . $this->info->getEtag() . '"'; - } - /** * Returns the mime-type for a file * diff --git a/lib/private/connector/sabre/filesplugin.php b/lib/private/connector/sabre/filesplugin.php index 5f83aa0fb5..30d1b1a872 100644 --- a/lib/private/connector/sabre/filesplugin.php +++ b/lib/private/connector/sabre/filesplugin.php @@ -107,6 +107,10 @@ class OC_Connector_Sabre_FilesPlugin extends \Sabre\DAV\ServerPlugin if (!is_null($fileId)) { $this->server->httpResponse->setHeader('OC-FileId', $fileId); } + $eTag = $node->getETag(); + if (!is_null($eTag)) { + $this->server->httpResponse->setHeader('OC-ETag', $eTag); + } } } diff --git a/lib/private/connector/sabre/node.php b/lib/private/connector/sabre/node.php index 6fc66377ba..2ac7363a15 100644 --- a/lib/private/connector/sabre/node.php +++ b/lib/private/connector/sabre/node.php @@ -270,4 +270,20 @@ abstract class OC_Connector_Sabre_Node implements \Sabre\DAV\INode, \Sabre\DAV\I } return $p; } + + /** + * Returns the ETag for a file + * + * An ETag is a unique identifier representing the current version of the + * file. If the file changes, the ETag MUST change. The ETag is an + * arbitrary string, but MUST be surrounded by double-quotes. + * + * Return null if the ETag can not effectively be determined + * + * @return mixed + */ + public function getETag() { + return '"' . $this->info->getEtag() . '"'; + } + }