diff --git a/core/js/share.js b/core/js/share.js
index 1c59524939cc70e67a9e7b15347c538a944555fb..a6f299214801012108a879040847e7ed14c2c1de 100644
--- a/core/js/share.js
+++ b/core/js/share.js
@@ -374,7 +374,7 @@ OC.Share={
 			if (data.shares) {
 				$.each(data.shares, function(index, share) {
 					if (share.share_type == OC.Share.SHARE_TYPE_LINK) {
-						if ( !('file_target' in share) ) {
+						if (itemSource === share.file_source || itemSource === share.item_source) {
 							OC.Share.showLink(share.token, share.share_with, itemSource);
 						}
 					} else {