return null instead of throwing an exception
This commit is contained in:
parent
bf8f910a32
commit
1deb6aadd3
|
@ -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);
|
||||
|
|
|
@ -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() {
|
||||
|
|
Loading…
Reference in New Issue