diff --git a/core/js/share.js b/core/js/share.js
index 34f24da4df746eeb788a104936888776210a2c96..8e767663f1285ca34e4bc63308b1905ed557ad87 100644
--- a/core/js/share.js
+++ b/core/js/share.js
@@ -10,8 +10,9 @@ OC.Share={
 		// Load all share icons
 		$.get(OC.filePath('core', 'ajax', 'share.php'), { fetch: 'getItemsSharedStatuses', itemType: itemType }, function(result) {
 			if (result && result.status === 'success') {
-				$.each(result.data, function(item, hasLink) {
-					OC.Share.statuses[item] = hasLink;
+				$.each(result.data, function(item, data) {
+					OC.Share.statuses[item] = data;
+					var hasLink = data['link'];
 					// Links override shared in terms of icon display
 					if (hasLink) {
 						var image = OC.imagePath('core', 'actions/public');
@@ -21,30 +22,33 @@ OC.Share={
 					if (itemType != 'file' && itemType != 'folder') {
 						$('a.share[data-item="'+item+'"]').css('background', 'url('+image+') no-repeat center');
 					} else {
-						var file = $('tr').filterAttr('data-file', OC.basename(item));
+						var file = $('tr').filterAttr('data-id', item);
 						if (file.length > 0) {
 							var action = $(file).find('.fileactions .action').filterAttr('data-action', 'Share');
 							var img = action.find('img').attr('src', image);
 							action.addClass('permanent');
 							action.html(' '+t('core', 'Shared')).prepend(img);
-						}
-						var dir = $('#dir').val();
-						if (dir.length > 1) {
-							var last = '';
-							var path = dir;
-							// Search for possible parent folders that are shared
-							while (path != last) {
-								if (path == item) {
-									var action = $('.fileactions .action').filterAttr('data-action', 'Share');
-									var img = action.find('img');
-									if (img.attr('src') != OC.imagePath('core', 'actions/public')) {
-										img.attr('src', image);
-										action.addClass('permanent');
-										action.html(' '+t('core', 'Shared')).prepend(img);
+						} else {
+							var dir = $('#dir').val();
+							if (dir.length > 1) {
+								var last = '';
+								var path = dir;
+								// Search for possible parent folders that are shared
+								while (path != last) {
+									if (path == data['path']) {
+										var actions = $('.fileactions .action').filterAttr('data-action', 'Share');
+										$.each(actions, function(index, action) {
+											var img = $(action).find('img');
+											if (img.attr('src') != OC.imagePath('core', 'actions/public')) {
+												img.attr('src', image);
+												$(action).addClass('permanent');
+												$(action).html(' '+t('core', 'Shared')).prepend(img);
+											}
+										});
 									}
+									last = path;
+									path = OC.Share.dirname(path);
 								}
-								last = path;
-								path = OC.Share.dirname(path);
 							}
 						}
 					}
@@ -53,15 +57,6 @@ OC.Share={
 		});
 	},
 	updateIcon:function(itemType, itemSource) {
-		if (itemType == 'file' || itemType == 'folder') {
-			var file = $('tr').filterAttr('data-id', String(itemSource));
-			var filename = file.data('file');
-			if ($('#dir').val() == '/') {
-				itemSource = $('#dir').val() + filename;
-			} else {
-				itemSource = $('#dir').val() + '/' + filename;
-			}
-		}
 		var shares = false;
 		var link = false;
 		var image = OC.imagePath('core', 'actions/share');
@@ -83,18 +78,21 @@ OC.Share={
 		if (itemType != 'file' && itemType != 'folder') {
 			$('a.share[data-item="'+itemSource+'"]').css('background', 'url('+image+') no-repeat center');
 		} else {
-			var action = $(file).find('.fileactions .action').filterAttr('data-action', 'Share');
-			var img = action.find('img').attr('src', image);
-			if (shares) {
-				action.addClass('permanent');
-				action.html(' '+t('core', 'Shared')).prepend(img);
-			} else {
-				action.removeClass('permanent');
-				action.html(' '+t('core', 'Share')).prepend(img);
+			var file = $('tr').filterAttr('data-id', String(itemSource));
+			if (file.length > 0) {
+				var action = $(file).find('.fileactions .action').filterAttr('data-action', 'Share');
+				var img = action.find('img').attr('src', image);
+				if (shares) {
+					action.addClass('permanent');
+					action.html(' '+ escapeHTML(t('core', 'Shared'))).prepend(img);
+				} else {
+					action.removeClass('permanent');
+					action.html(' '+ escapeHTML(t('core', 'Share'))).prepend(img);
+				}
 			}
 		}
 		if (shares) {
-			OC.Share.statuses[itemSource] = link;
+			OC.Share.statuses[itemSource]['link'] = link;
 		} else {
 			delete OC.Share.statuses[itemSource];
 		}
@@ -102,21 +100,7 @@ OC.Share={
 	loadItem:function(itemType, itemSource) {
 		var data = '';
 		var checkReshare = true;
-		// Switch file sources to path to check if status is set
-		if (itemType == 'file' || itemType == 'folder') {
-			var filename = $('tr').filterAttr('data-id', String(itemSource)).data('file');
-			if ($('#dir').val() == '/') {
-				var item = $('#dir').val() + filename;
-			} else {
-				var item = $('#dir').val() + '/' + filename;
-			}
-			if (item.substring(0, 8) != '/Shared/') {
-				checkReshare = false;
-			}
-		} else {
-			var item = itemSource;
-		}
-		if (typeof OC.Share.statuses[item] === 'undefined') {
+		if (typeof OC.Share.statuses[itemSource] === 'undefined') {
 			// NOTE: Check does not always work and misses some shares, fix later
 			checkShares = true;
 		} else {
diff --git a/lib/public/share.php b/lib/public/share.php
index bc404e2963f7650ca14df15f2fab6e32b04fcb76..8b8a41d47c0f21121b82e97ec02bf3c1d3627c46 100644
--- a/lib/public/share.php
+++ b/lib/public/share.php
@@ -783,7 +783,7 @@ class Share {
 		if ($format == self::FORMAT_STATUSES) {
 			if ($itemType == 'file' || $itemType == 'folder') {
 				$select = '`*PREFIX*share`.`id`, `item_type`, `*PREFIX*share`.`parent`,'
-					.' `share_type`, `file_source`, `path`, `expiration`';
+					.' `share_type`, `file_source`, `path`, `expiration`, `storage`';
 			} else {
 				$select = '`id`, `item_type`, `item_source`, `parent`, `share_type`, `expiration`';
 			}
@@ -792,7 +792,7 @@ class Share {
 				if ($itemType == 'file' || $itemType == 'folder') {
 					$select = '`*PREFIX*share`.`id`, `item_type`, `*PREFIX*share`.`parent`,'
 						.' `share_type`, `share_with`, `file_source`, `path`, `permissions`, `stime`,'
-						.' `expiration`, `token`';
+						.' `expiration`, `token`, `storage`';
 				} else {
 					$select = '`id`, `item_type`, `item_source`, `parent`, `share_type`, `share_with`, `permissions`,'
 						.' `stime`, `file_source`, `expiration`, `token`';
@@ -828,6 +828,7 @@ class Share {
 		$items = array();
 		$targets = array();
 		$switchedItems = array();
+		$mounts = array();
 		while ($row = $result->fetchRow()) {
 			// Filter out duplicate group shares for users with unique targets
 			if ($row['share_type'] == self::$shareTypeGroupUserUnique && isset($items[$row['parent']])) {
@@ -872,8 +873,13 @@ class Share {
 				if (isset($row['parent'])) {
 					$row['path'] = '/Shared/'.basename($row['path']);
 				} else {
-					// Strip 'files' from path
-					$row['path'] = substr($row['path'], 5);
+					if (!isset($mounts[$row['storage']])) {
+						$mounts[$row['storage']] = \OC\Files\Mount::findByNumericId($row['storage']);
+					}
+					if ($mounts[$row['storage']]) {
+						$path = $mounts[$row['storage']]->getMountPoint().$row['path'];
+						$row['path'] = substr($path, $root);
+					}
 				}
 			}
 			if (isset($row['expiration'])) {
@@ -981,15 +987,14 @@ class Share {
 				return $items;
 			} else if ($format == self::FORMAT_STATUSES) {
 				$statuses = array();
-				// Switch column to path for files and folders, used for determining statuses inside of folders
-				if ($itemType == 'file' || $itemType == 'folder') {
-					$column = 'path';
-				}
 				foreach ($items as $item) {
 					if ($item['share_type'] == self::SHARE_TYPE_LINK) {
-						$statuses[$item[$column]] = true;
+						$statuses[$item[$column]]['link'] = true;
 					} else if (!isset($statuses[$item[$column]])) {
-						$statuses[$item[$column]] = false;
+						$statuses[$item[$column]]['link'] = false;
+					}
+					if ($itemType == 'file' || $itemType == 'folder') {
+						$statuses[$item[$column]]['path'] = $item['path'];
 					}
 				}
 				return $statuses;