[master] DAV: Return data-fingerprint always when asked (#25482)

For owncloud/client#5056
Users can configure arbitrary subfolders for syncing, therefore we should
always return it when asked for.
The sync client makes sure to not always ask for it to save bandwidth.
This commit is contained in:
Markus Goetz 2016-08-13 17:03:54 +02:00 committed by Arthur Schiwon
parent dbc860e6f7
commit 4685ca9154
No known key found for this signature in database
GPG Key ID: 7424F1874854DF23
2 changed files with 6 additions and 9 deletions

View File

@ -324,18 +324,13 @@ class FilesPlugin extends ServerPlugin {
return $displayName; return $displayName;
}); });
$propFind->handle(self::DATA_FINGERPRINT_PROPERTYNAME, function() use ($node) {
if ($node->getPath() === '/') {
return $this->config->getSystemValue('data-fingerprint', '');
}
});
$propFind->handle(self::HAS_PREVIEW_PROPERTYNAME, function () use ($node) { $propFind->handle(self::HAS_PREVIEW_PROPERTYNAME, function () use ($node) {
return json_encode($this->previewManager->isAvailable($node->getFileInfo())); return json_encode($this->previewManager->isAvailable($node->getFileInfo()));
}); });
} }
if ($node instanceof \OCA\DAV\Files\FilesHome) { if ($node instanceof \OCA\DAV\Connector\Sabre\Node
|| $node instanceof \OCA\DAV\Files\FilesHome) {
$propFind->handle(self::DATA_FINGERPRINT_PROPERTYNAME, function() use ($node) { $propFind->handle(self::DATA_FINGERPRINT_PROPERTYNAME, function() use ($node) {
return $this->config->getSystemValue('data-fingerprint', ''); return $this->config->getSystemValue('data-fingerprint', '');
}); });

View File

@ -213,7 +213,8 @@ class FilesPluginTest extends TestCase {
$this->assertEquals('http://example.com/', $propFind->get(self::DOWNLOADURL_PROPERTYNAME)); $this->assertEquals('http://example.com/', $propFind->get(self::DOWNLOADURL_PROPERTYNAME));
$this->assertEquals('foo', $propFind->get(self::OWNER_ID_PROPERTYNAME)); $this->assertEquals('foo', $propFind->get(self::OWNER_ID_PROPERTYNAME));
$this->assertEquals('M. Foo', $propFind->get(self::OWNER_DISPLAY_NAME_PROPERTYNAME)); $this->assertEquals('M. Foo', $propFind->get(self::OWNER_DISPLAY_NAME_PROPERTYNAME));
$this->assertEquals([self::SIZE_PROPERTYNAME, self::DATA_FINGERPRINT_PROPERTYNAME], $propFind->get404Properties()); $this->assertEquals('my_fingerprint', $propFind->get(self::DATA_FINGERPRINT_PROPERTYNAME));
$this->assertEquals([self::SIZE_PROPERTYNAME], $propFind->get404Properties());
} }
public function testGetPropertiesForFileHome() { public function testGetPropertiesForFileHome() {
@ -357,7 +358,8 @@ class FilesPluginTest extends TestCase {
$this->assertEquals(1025, $propFind->get(self::SIZE_PROPERTYNAME)); $this->assertEquals(1025, $propFind->get(self::SIZE_PROPERTYNAME));
$this->assertEquals('DWCKMSR', $propFind->get(self::PERMISSIONS_PROPERTYNAME)); $this->assertEquals('DWCKMSR', $propFind->get(self::PERMISSIONS_PROPERTYNAME));
$this->assertEquals(null, $propFind->get(self::DOWNLOADURL_PROPERTYNAME)); $this->assertEquals(null, $propFind->get(self::DOWNLOADURL_PROPERTYNAME));
$this->assertEquals([self::DOWNLOADURL_PROPERTYNAME, self::DATA_FINGERPRINT_PROPERTYNAME], $propFind->get404Properties()); $this->assertEquals('my_fingerprint', $propFind->get(self::DATA_FINGERPRINT_PROPERTYNAME));
$this->assertEquals([self::DOWNLOADURL_PROPERTYNAME], $propFind->get404Properties());
} }
public function testGetPropertiesForRootDirectory() { public function testGetPropertiesForRootDirectory() {