diff --git a/inc/lib_filesystem.php b/inc/lib_filesystem.php
index c8cbd1cb80d1954083130fcfd5007e8b842e60c0..60201825e061613bc8b7bf11766acec9dbb1c760 100644
--- a/inc/lib_filesystem.php
+++ b/inc/lib_filesystem.php
@@ -169,9 +169,15 @@ class OC_FILESYSTEM{
 		if(substr($path,0,1)!=='/'){
 			$path='/'.$path;
 		}
+		if(substr($path,-1)!=='/'){
+			$path=$path.'/';
+		}
 		$path=self::$fakeRoot.$path;
 		$foundMountPoint='';
 		foreach(self::$storages as $mountpoint=>$storage){
+			if(substr($mountpoint,-1)!=='/'){
+				$mountpoint=$mountpoint.'/';
+			}
 			if($mountpoint==$path){
 				return $mountpoint;
 			}