Fix resolving paths for views rooted in a file
This commit is contained in:
parent
099d43b1f9
commit
ddee63fa00
|
@ -293,7 +293,7 @@ class Filesystem {
|
||||||
}
|
}
|
||||||
$mount = self::$mounts->find($path);
|
$mount = self::$mounts->find($path);
|
||||||
if ($mount) {
|
if ($mount) {
|
||||||
return array($mount->getStorage(), $mount->getInternalPath($path));
|
return array($mount->getStorage(), rtrim($mount->getInternalPath($path), '/'));
|
||||||
} else {
|
} else {
|
||||||
return array(null, null);
|
return array(null, null);
|
||||||
}
|
}
|
||||||
|
|
|
@ -729,6 +729,22 @@ class View extends \Test\TestCase {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testFileView() {
|
||||||
|
$storage = new Temporary(array());
|
||||||
|
$scanner = $storage->getScanner();
|
||||||
|
$storage->file_put_contents('foo.txt', 'bar');
|
||||||
|
\OC\Files\Filesystem::mount($storage, array(), '/test/');
|
||||||
|
$scanner->scan('');
|
||||||
|
$view = new \OC\Files\View('/test/foo.txt');
|
||||||
|
|
||||||
|
$this->assertEquals('bar', $view->file_get_contents(''));
|
||||||
|
$fh = tmpfile();
|
||||||
|
fwrite($fh, 'foo');
|
||||||
|
rewind($fh);
|
||||||
|
$view->file_put_contents('', $fh);
|
||||||
|
$this->assertEquals('foo', $view->file_get_contents(''));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @dataProvider tooLongPathDataProvider
|
* @dataProvider tooLongPathDataProvider
|
||||||
* @expectedException \OCP\Files\InvalidPathException
|
* @expectedException \OCP\Files\InvalidPathException
|
||||||
|
|
Loading…
Reference in New Issue