diff options
author | Robin Appelman <icewind@owncloud.com> | 2014-08-06 12:06:41 +0200 |
---|---|---|
committer | Robin Appelman <icewind@owncloud.com> | 2014-08-06 12:06:41 +0200 |
commit | 1deb6aadd305d9c211d5cd640cfa7780119d644c (patch) | |
tree | b9cdc5511453298f290a0c0d52f06ff5020ca82f | |
parent | bf8f910a32ca20d9d2cdadfec9f46694b9a53190 (diff) | |
download | nextcloud-server-1deb6aadd305d9c211d5cd640cfa7780119d644c.tar.gz nextcloud-server-1deb6aadd305d9c211d5cd640cfa7780119d644c.zip |
return null instead of throwing an exception
-rw-r--r-- | lib/private/files/node/folder.php | 3 | ||||
-rw-r--r-- | tests/lib/files/node/folder.php | 6 |
2 files changed, 3 insertions, 6 deletions
diff --git a/lib/private/files/node/folder.php b/lib/private/files/node/folder.php index f5211d5d748..8c7acc339ae 100644 --- a/lib/private/files/node/folder.php +++ b/lib/private/files/node/folder.php @@ -27,7 +27,6 @@ class Folder extends Node implements \OCP\Files\Folder { /** * @param string $path - * @throws \OCP\Files\NotFoundException * @return string */ public function getRelativePath($path) { @@ -37,7 +36,7 @@ class Folder extends Node implements \OCP\Files\Folder { if ($path === $this->path) { return '/'; } else if (strpos($path, $this->path . '/') !== 0) { - throw new NotFoundException(); + return null; } else { $path = substr($path, strlen($this->path)); return $this->normalizePath($path); diff --git a/tests/lib/files/node/folder.php b/tests/lib/files/node/folder.php index bd9c2890cf0..436161aba72 100644 --- a/tests/lib/files/node/folder.php +++ b/tests/lib/files/node/folder.php @@ -513,9 +513,6 @@ class Folder extends \PHPUnit_Framework_TestCase { $this->assertEquals('/bar/foo/qwerty', $result[0]->getPath()); } - /** - * @expectedException \OCP\Files\NotFoundException - */ public function testGetByIdOutsideFolder() { $manager = $this->getMock('\OC\Files\Mount\Manager'); /** @@ -550,7 +547,8 @@ class Folder extends \PHPUnit_Framework_TestCase { ->will($this->returnValue($mount)); $node = new \OC\Files\Node\Folder($root, $view, '/bar/foo'); - $node->getById(1); + $result = $node->getById(1); + $this->assertCount(0, $result); } public function testGetByIdMultipleStorages() { |