From 1522f7f21185d2f3d3b5edebaa09f3e2f3a454aa Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Tue, 14 Aug 2012 03:07:14 +0200 Subject: [PATCH] fix some minor problems with path noramlization --- lib/filesystem.php | 2 +- lib/filesystemview.php | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/filesystem.php b/lib/filesystem.php index 221345332b..6cba6b1b54 100644 --- a/lib/filesystem.php +++ b/lib/filesystem.php @@ -503,7 +503,7 @@ class OC_Filesystem{ $path='/'.$path; } //remove trainling slash - if(substr($path,-1,1)==='/'){ + if(strlen($path)>1 and substr($path,-1,1)==='/'){ $path=substr($path,0,-1); } //remove duplicate slashes diff --git a/lib/filesystemview.php b/lib/filesystemview.php index 17d09a0700..9d85befdc8 100644 --- a/lib/filesystemview.php +++ b/lib/filesystemview.php @@ -103,7 +103,12 @@ class OC_FilesystemView { if(strpos($path, $this->fakeRoot)!==0) { return null; }else{ - return substr($path, strlen($this->fakeRoot)); + $path=substr($path, strlen($this->fakeRoot)); + if(strlen($path)===0){ + return '/'; + }else{ + return $path; + } } }