Skip to content

Commit

Permalink
[master] DAV: Return data-fingerprint always when asked (#25482)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
guruz authored and DeepDiver1975 committed Aug 13, 2016
1 parent 460a772 commit 82ddb09
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 9 deletions.
9 changes: 2 additions & 7 deletions apps/dav/lib/Connector/Sabre/FilesPlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -308,15 +308,10 @@ public function handleGetProperties(PropFind $propFind, \Sabre\DAV\INode $node)
$displayName = $owner->getDisplayName();
return $displayName;
});

$propFind->handle(self::DATA_FINGERPRINT_PROPERTYNAME, function() use ($node) {
if ($node->getPath() === '/') {
return $this->config->getSystemValue('data-fingerprint', '');
}
});
}

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) {
return $this->config->getSystemValue('data-fingerprint', '');
});
Expand Down
6 changes: 4 additions & 2 deletions apps/dav/tests/unit/Connector/Sabre/FilesPluginTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,8 @@ public function testGetPropertiesForFile() {
$this->assertEquals('http://example.com/', $propFind->get(self::DOWNLOADURL_PROPERTYNAME));
$this->assertEquals('foo', $propFind->get(self::OWNER_ID_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() {
Expand Down Expand Up @@ -332,7 +333,8 @@ public function testGetPropertiesForDirectory() {
$this->assertEquals(1025, $propFind->get(self::SIZE_PROPERTYNAME));
$this->assertEquals('DWCKMSR', $propFind->get(self::PERMISSIONS_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() {
Expand Down

0 comments on commit 82ddb09

Please sign in to comment.