Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
DAV: Return data-fingerprint always when asked
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 Vincent Petry committed Aug 11, 2016
commit 15cfd4922da756fea6aeaa79d6beca127b2b496b
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) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm surprised that FilesHome isn't a Sabre\Node ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was too ;)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FileHome implements ICollection
ICollection extends INode

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The if where I moved it out is \OCA\DAV\Connector\Sabre\Node not INode..

$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