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> | 2015-03-24 21:36:46 +0100 |
commit | 30ee8b6f998b4b2e27da92b3adcdbc4683d3bcde (patch) | |
tree | cf852346187abdefb2cda4005d50e2259a4bcbdf /lib | |
parent | 2370af62ea5ef3c276cd4c3db52509dc0c503559 (diff) | |
download | nextcloud-server-30ee8b6f998b4b2e27da92b3adcdbc4683d3bcde.tar.gz nextcloud-server-30ee8b6f998b4b2e27da92b3adcdbc4683d3bcde.zip |
adding OC-ETag header
Diffstat (limited to 'lib')
-rw-r--r-- | lib/private/connector/sabre/file.php | 5 | ||||
-rw-r--r-- | lib/private/connector/sabre/filesplugin.php | 17 |
2 files changed, 20 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..e03cac9c537 100644 --- a/lib/private/connector/sabre/filesplugin.php +++ b/lib/private/connector/sabre/filesplugin.php @@ -174,7 +174,24 @@ 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 + */ + private function getETag($node) { + if (isset($_SERVER['HTTP_OC_CHUNKED'])) { + if (isset($_SERVER['X-CHUNKING_COMPLETE'])) { + return $node->getETag(); + } + return null; } + return $node->getETag(); } } |