diff --git a/lib/files/view.php b/lib/files/view.php
index e9b583f8ae6902789249cde2c09286bae4e5e966..04b7dca8afcd2df4e3423c044930883fa772a05d 100644
--- a/lib/files/view.php
+++ b/lib/files/view.php
@@ -712,7 +712,7 @@ class View {
 		$files = $cache->getFolderContents($internalPath); //TODO: mimetype_filter
 
 		//add a folder for any mountpoint in this directory and add the sizes of other mountpoints to the folders
-		$mountPoints = Filesystem::getMountPoints($directory);
+		$mountPoints = Filesystem::getMountPoints($path);
 		$dirLength = strlen($path);
 		foreach ($mountPoints as $mountPoint) {
 			$subStorage = Filesystem::getStorage($mountPoint);
@@ -733,6 +733,10 @@ class View {
 			}
 		}
 
+		foreach($files as $i => $file){
+			$files[$i]['type'] = $file['mimetype'] === 'httpd/unix-directory' ? 'dir' : 'file';
+		}
+
 		usort($files, "fileCmp"); //TODO: remove this once ajax is merged
 		return $files;
 	}