change behaviour of Filesystem::getMountPoint when a mountpoint is passed as path without trailing slash
This commit is contained in:
parent
d3e37fa157
commit
709aacfa0f
3 changed files with 14 additions and 8 deletions
|
@ -144,13 +144,7 @@ class Filesystem {
|
|||
*/
|
||||
static public function getMountPoint($path) {
|
||||
\OC_Hook::emit(self::CLASSNAME, 'get_mountpoint', array('path' => $path));
|
||||
if (!$path) {
|
||||
$path = '/';
|
||||
}
|
||||
if ($path[0] !== '/') {
|
||||
$path = '/' . $path;
|
||||
}
|
||||
$path = str_replace('//', '/', $path);
|
||||
$path = self::normalizePath($path) . '/';
|
||||
$foundMountPoint = '';
|
||||
$mountPoints = array_keys(self::$mounts);
|
||||
foreach ($mountPoints as $mountpoint) {
|
||||
|
|
|
@ -60,7 +60,7 @@ class Filesystem extends \PHPUnit_Framework_TestCase {
|
|||
$this->assertEquals('/',\OC\Files\Filesystem::getMountPoint('/'));
|
||||
$this->assertEquals('/some/',\OC\Files\Filesystem::getMountPoint('/some/folder'));
|
||||
$this->assertEquals('/some/',\OC\Files\Filesystem::getMountPoint('/some/'));
|
||||
$this->assertEquals('/',\OC\Files\Filesystem::getMountPoint('/some'));
|
||||
$this->assertEquals('/some/',\OC\Files\Filesystem::getMountPoint('/some'));
|
||||
list( , $internalPath)=\OC\Files\Filesystem::resolvePath('/some/folder');
|
||||
$this->assertEquals('folder',$internalPath);
|
||||
}
|
||||
|
|
|
@ -71,6 +71,18 @@ class View extends \PHPUnit_Framework_TestCase {
|
|||
$this->assertEquals($storageSize + $textSize, $folderData[2]['size']);
|
||||
$this->assertEquals($storageSize, $folderData[3]['size']);
|
||||
|
||||
$folderData = $rootView->getDirectoryContent('/substorage');
|
||||
/**
|
||||
* expected entries:
|
||||
* foo.png
|
||||
* foo.txt
|
||||
* folder
|
||||
*/
|
||||
$this->assertEquals(3, count($folderData));
|
||||
$this->assertEquals('foo.png', $folderData[0]['name']);
|
||||
$this->assertEquals('foo.txt', $folderData[1]['name']);
|
||||
$this->assertEquals('folder', $folderData[2]['name']);
|
||||
|
||||
$folderView = new \OC\Files\View('/folder');
|
||||
$this->assertEquals($rootView->getFileInfo('/folder'), $folderView->getFileInfo('/'));
|
||||
|
||||
|
|
Loading…
Reference in a new issue