ensure comments-href returns a value also when propfind is done against remote.php/files

This commit is contained in:
Arthur Schiwon 2016-02-27 00:59:46 +01:00 committed by Vincent Petry
parent 59a85a4c76
commit 2b30136ae9
No known key found for this signature in database
GPG Key ID: AF8F9EFC56562186
2 changed files with 5 additions and 4 deletions

View File

@ -99,13 +99,13 @@ class CommentPropertiesPlugin extends ServerPlugin {
*/
public function getCommentsLink(Node $node) {
$href = $this->server->getBaseUri();
$entryPoint = strrpos($href, '/webdav/');
$entryPoint = strpos($href, '/remote.php/');
if($entryPoint === false) {
// in case we end up somewhere else, unexpectedly.
return null;
}
$href = substr_replace($href, '/dav/', $entryPoint);
$href .= 'comments/files/' . rawurldecode($node->getId());
$commentsPart = 'dav/comments/files/' . rawurldecode($node->getId());
$href = substr_replace($href, $commentsPart, $entryPoint + strlen('/remote.php/'));
return $href;
}

View File

@ -84,7 +84,8 @@ class CommentsPropertiesPlugin extends \Test\TestCase {
public function baseUriProvider() {
return [
['owncloud/remote.php/webdav/', '4567', 'owncloud/remote.php/dav/comments/files/4567'],
['owncloud/remote.php/wicked/', '4567', null]
['owncloud/remote.php/files/', '4567', 'owncloud/remote.php/dav/comments/files/4567'],
['owncloud/wicked.php/files/', '4567', null]
];
}