Skip to content
Snippets Groups Projects
Commit e63e246c authored by Robin Appelman's avatar Robin Appelman
Browse files

fix problem with normalizePath when there was a double leading slash

parent 39adadd3
No related branches found
No related tags found
No related merge requests found
...@@ -595,14 +595,14 @@ class Filesystem { ...@@ -595,14 +595,14 @@ class Filesystem {
if ($path[0] !== '/') { if ($path[0] !== '/') {
$path = '/' . $path; $path = '/' . $path;
} }
//remove trailing slash
if ($stripTrailingSlash and strlen($path) > 1 and substr($path, -1, 1) === '/') {
$path = substr($path, 0, -1);
}
//remove duplicate slashes //remove duplicate slashes
while (strpos($path, '//') !== false) { while (strpos($path, '//') !== false) {
$path = str_replace('//', '/', $path); $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 //normalize unicode if possible
if (class_exists('Normalizer')) { if (class_exists('Normalizer')) {
$path = \Normalizer::normalize($path); $path = \Normalizer::normalize($path);
......
...@@ -69,6 +69,9 @@ class View extends \PHPUnit_Framework_TestCase { ...@@ -69,6 +69,9 @@ class View extends \PHPUnit_Framework_TestCase {
$this->assertEquals($imageSize, $folderData[1]['size']); $this->assertEquals($imageSize, $folderData[1]['size']);
$this->assertEquals($textSize, $folderData[2]['size']); $this->assertEquals($textSize, $folderData[2]['size']);
$this->assertEquals($storageSize, $folderData[3]['size']); $this->assertEquals($storageSize, $folderData[3]['size']);
$folderView = new \OC\Files\View('/folder');
$this->assertEquals($rootView->getFileInfo('/folder'), $folderView->getFileInfo('/'));
} }
public function testAutoScan() { public function testAutoScan() {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment