Merge pull request #15218 from owncloud/revert-oc-etag-master

Revert oc etag master
This commit is contained in:
Thomas Müller 2015-03-26 15:34:24 +01:00
commit e66dda83df
3 changed files with 2 additions and 48 deletions

View file

@ -247,7 +247,8 @@ 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);
@ -304,8 +305,6 @@ 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) {

View file

@ -174,21 +174,7 @@ 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();
}
}

View file

@ -171,35 +171,4 @@ class FilesPlugin extends \Test\TestCase {
$this->assertEquals(200, $result[self::GETETAG_PROPERTYNAME]);
}
/**
* @dataProvider providesETagTestData
* @param $expectedETag
* @param $isChunked
* @param $isChunkComplete
*/
public function testETag($expectedETag, $isChunked, $isChunkComplete) {
if (!is_null($isChunked)) {
$_SERVER['HTTP_OC_CHUNKED'] = $isChunked;
}
if (!is_null($isChunkComplete)) {
$_SERVER['X-CHUNKING_COMPLETE'] = $isChunkComplete;
}
$node = $this->createTestNode('\OC\Connector\Sabre\File');
$etag = $this->plugin->getETag($node);
$this->assertEquals($expectedETag, $etag);
}
public function providesETagTestData() {
return [
// non-chunked tests
['"abc"', null, null],
['"abc"', null, false],
// chunked tests
[null, true, null],
['"abc"', true, true],
];
}
}