diff options
author | Thomas Müller <thomas.mueller@tmit.eu> | 2014-08-29 12:09:33 +0200 |
---|---|---|
committer | Thomas Müller <thomas.mueller@tmit.eu> | 2014-08-29 12:09:33 +0200 |
commit | 96a931929ea837a40a7e9b836252587c949a8127 (patch) | |
tree | 543aa94b3ad53eafb752e7b05429ab0eea5d245b | |
parent | ed2424c3822a3470065788ff113a3807d24d80dc (diff) | |
download | nextcloud-server-96a931929ea837a40a7e9b836252587c949a8127.tar.gz nextcloud-server-96a931929ea837a40a7e9b836252587c949a8127.zip |
adding OC-ETag header
-rw-r--r-- | lib/private/connector/sabre/file.php | 15 | ||||
-rw-r--r-- | lib/private/connector/sabre/filesplugin.php | 4 | ||||
-rw-r--r-- | 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 ece6885f24f..44c86e69719 100644 --- a/lib/private/connector/sabre/file.php +++ b/lib/private/connector/sabre/file.php @@ -181,21 +181,6 @@ class OC_Connector_Sabre_File extends OC_Connector_Sabre_Node implements \Sabre\ } /** - * 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 * * If null is returned, we'll assume application/octet-stream diff --git a/lib/private/connector/sabre/filesplugin.php b/lib/private/connector/sabre/filesplugin.php index 5f83aa0fb55..30d1b1a872c 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 6fc66377ba8..2ac7363a15e 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() . '"'; + } + } |