Skip to content
Snippets Groups Projects
Commit 26c0007a authored by Victor Dubiniuk's avatar Victor Dubiniuk
Browse files

Merge pull request #5263 from owncloud/fixing-5255-master

Proper behavior of resolvePath()
parents 0641365a bc6e352c
Branches
No related tags found
No related merge requests found
...@@ -110,7 +110,9 @@ class View { ...@@ -110,7 +110,9 @@ class View {
* @return array consisting of the storage and the internal path * @return array consisting of the storage and the internal path
*/ */
public function resolvePath($path) { public function resolvePath($path) {
return Filesystem::resolvePath($this->getAbsolutePath($path)); $a = $this->getAbsolutePath($path);
$p = Filesystem::normalizePath($a);
return Filesystem::resolvePath($p);
} }
/** /**
......
...@@ -434,4 +434,38 @@ class View extends \PHPUnit_Framework_TestCase { ...@@ -434,4 +434,38 @@ class View extends \PHPUnit_Framework_TestCase {
$view->file_put_contents('/asd.txt', 'foo'); $view->file_put_contents('/asd.txt', 'foo');
$this->assertNull($this->createHookPath); $this->assertNull($this->createHookPath);
} }
/**
* @dataProvider resolvePathTestProvider
*/
public function testResolvePath($expected, $pathToTest) {
$storage1 = $this->getTestStorage();
\OC\Files\Filesystem::mount($storage1, array(), '/');
$view = new \OC\Files\View('');
$result = $view->resolvePath($pathToTest);
$this->assertEquals($expected, $result[1]);
$exists = $view->file_exists($pathToTest);
$this->assertTrue($exists);
$exists = $view->file_exists($result[1]);
$this->assertTrue($exists);
}
function resolvePathTestProvider() {
return array(
array('foo.txt', 'foo.txt'),
array('foo.txt', '/foo.txt'),
array('folder', 'folder'),
array('folder', '/folder'),
array('folder', 'folder/'),
array('folder', '/folder/'),
array('folder/bar.txt', 'folder/bar.txt'),
array('folder/bar.txt', '/folder/bar.txt'),
array('', ''),
array('', '/'),
);
}
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment