diff options
author | Thomas Müller <thomas.mueller@tmit.eu> | 2014-09-03 11:21:47 +0200 |
---|---|---|
committer | Thomas Müller <thomas.mueller@tmit.eu> | 2014-09-03 11:21:47 +0200 |
commit | 52dc31e13c4872dbf10f7033591568ca4ec9cec3 (patch) | |
tree | 5ee93048e1c4c5856438ae9b81e8f73500319a72 /lib/private | |
parent | 8787162ec990f689256d2a8e5f68630ee52c29bc (diff) | |
parent | 96a931929ea837a40a7e9b836252587c949a8127 (diff) | |
download | nextcloud-server-52dc31e13c4872dbf10f7033591568ca4ec9cec3.tar.gz nextcloud-server-52dc31e13c4872dbf10f7033591568ca4ec9cec3.zip |
Merge pull request #10725 from owncloud/sabredav-etag-master
adding OC-ETag header
Diffstat (limited to 'lib/private')
-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() . '"'; + } + } |