summaryrefslogtreecommitdiffstats
path: root/lib/private
diff options
context:
space:
mode:
authorVincent Petry <pvince81@owncloud.com>2015-03-26 13:52:43 +0100
committerVincent Petry <pvince81@owncloud.com>2015-03-26 13:52:43 +0100
commitcda7f7fd6190d15a81897c4557005a6c661b8f2c (patch)
tree564d94a86b6a940ab2209ec145636ebeaaf4d203 /lib/private
parent468456e1688dda50c046d42fcdf3c570c6e4e50d (diff)
parent8d327c94a844804d0e7af057866e552bd5aafd17 (diff)
downloadnextcloud-server-cda7f7fd6190d15a81897c4557005a6c661b8f2c.tar.gz
nextcloud-server-cda7f7fd6190d15a81897c4557005a6c661b8f2c.zip
Merge pull request #15168 from owncloud/oc-etag-master
adding OC-ETag header
Diffstat (limited to 'lib/private')
-rw-r--r--lib/private/connector/sabre/file.php5
-rw-r--r--lib/private/connector/sabre/filesplugin.php14
2 files changed, 17 insertions, 2 deletions
diff --git a/lib/private/connector/sabre/file.php b/lib/private/connector/sabre/file.php
index 8f0642d794a..bb68f446725 100644
--- a/lib/private/connector/sabre/file.php
+++ b/lib/private/connector/sabre/file.php
@@ -247,8 +247,7 @@ class File extends \OC\Connector\Sabre\Node implements \Sabre\DAV\IFile {
* @throws \Sabre\DAV\Exception\NotImplemented
* @throws \Sabre\DAV\Exception\ServiceUnavailable
*/
- private function createFileChunked($data)
- {
+ private function createFileChunked($data) {
list($path, $name) = \Sabre\HTTP\URLUtil::splitPath($this->path);
$info = \OC_FileChunking::decodeName($name);
@@ -305,6 +304,8 @@ class File extends \OC\Connector\Sabre\Node implements \Sabre\DAV\IFile {
}
}
+ // mark chunking complete
+ $_SERVER['X-CHUNKING_COMPLETE'] = true;
$info = $this->fileView->getFileInfo($targetPath);
return $info->getEtag();
} catch (\OCP\Files\StorageNotAvailableException $e) {
diff --git a/lib/private/connector/sabre/filesplugin.php b/lib/private/connector/sabre/filesplugin.php
index 9720519f4c7..1b4b0674a57 100644
--- a/lib/private/connector/sabre/filesplugin.php
+++ b/lib/private/connector/sabre/filesplugin.php
@@ -174,7 +174,21 @@ class FilesPlugin extends \Sabre\DAV\ServerPlugin {
if (!is_null($fileId)) {
$this->server->httpResponse->setHeader('OC-FileId', $fileId);
}
+ $eTag = $this->getETag($node);
+ if (!is_null($eTag)) {
+ $this->server->httpResponse->setHeader('OC-ETag', $eTag);
+ }
+ }
+ }
+
+ /**
+ * @param \OC\Connector\Sabre\Node $node
+ */
+ public function getETag($node) {
+ if (isset($_SERVER['HTTP_OC_CHUNKED']) && !isset($_SERVER['X-CHUNKING_COMPLETE'])) {
+ return null;
}
+ return $node->getETag();
}
}