diff --git a/apps/files_sharing/public.php b/apps/files_sharing/public.php
index 13a328ff74ce61016441683294754547259dea86..67b2dca8c9e7b51c7fc5115b5c83f707f647c94c 100644
--- a/apps/files_sharing/public.php
+++ b/apps/files_sharing/public.php
@@ -122,12 +122,16 @@ if (isset($_GET['file']) || isset($_GET['dir'])) {
 					// Make breadcrumb
 					$breadcrumb = array();
 					$pathtohere = '';
+					$count = 1;
 					foreach (explode('/', $dir) as $i) {
 						if ($i != '') {
 							if ($i != $baseDir) {
 								$pathtohere .= '/'.$i;
+							}						
+							if ( strlen($pathtohere) <  strlen($_GET['dir'])) {
+								continue;
 							}
-							$breadcrumb[] = array('dir' => $pathtohere, 'name' => $i);
+							$breadcrumb[] = array('dir' => str_replace($_GET['dir'], "", $pathtohere, $count), 'name' => $i);
 						}
 					}
 					$list = new OCP\Template('files', 'part.list', '');