fix problem with normalizePath when there was a double leading slash

This commit is contained in:
Robin Appelman 2012-10-26 12:37:49 +02:00
parent 39adadd3e3
commit e63e246c48
2 changed files with 7 additions and 4 deletions

View File

@ -595,14 +595,14 @@ class Filesystem {
if ($path[0] !== '/') {
$path = '/' . $path;
}
//remove trailing slash
if ($stripTrailingSlash and strlen($path) > 1 and substr($path, -1, 1) === '/') {
$path = substr($path, 0, -1);
}
//remove duplicate slashes
while (strpos($path, '//') !== false) {
$path = str_replace('//', '/', $path);
}
//remove trailing slash
if ($stripTrailingSlash and strlen($path) > 1 and substr($path, -1, 1) === '/') {
$path = substr($path, 0, -1);
}
//normalize unicode if possible
if (class_exists('Normalizer')) {
$path = \Normalizer::normalize($path);

View File

@ -69,6 +69,9 @@ class View extends \PHPUnit_Framework_TestCase {
$this->assertEquals($imageSize, $folderData[1]['size']);
$this->assertEquals($textSize, $folderData[2]['size']);
$this->assertEquals($storageSize, $folderData[3]['size']);
$folderView = new \OC\Files\View('/folder');
$this->assertEquals($rootView->getFileInfo('/folder'), $folderView->getFileInfo('/'));
}
public function testAutoScan() {