diff --git a/core/js/share.js b/core/js/share.js
index e67b333dfc113f95b80a45d0ac496310b6d2485b..43688ba270eb366a43e7510698ee715a6fdf2287 100644
--- a/core/js/share.js
+++ b/core/js/share.js
@@ -306,13 +306,14 @@ OC.Share={
 		OC.Share.itemShares[OC.Share.SHARE_TYPE_LINK] = true;
 		$('#linkCheckbox').attr('checked', true);
 		var filename = $('tr').filterAttr('data-id', String(itemSource)).data('file');
+		var type = $('tr').filterAttr('data-id', String(itemSource)).data('type');
 		if ($('#dir').val() == '/') {
 			var file = $('#dir').val() + filename;
 		} else {
 			var file = $('#dir').val() + '/' + filename;
 		}
 		file = '/'+OC.currentUser+'/files'+file;
-		var link = parent.location.protocol+'//'+location.host+OC.linkTo('', 'public.php')+'?service=files&file='+file;
+		var link = parent.location.protocol+'//'+location.host+OC.linkTo('', 'public.php')+'?service=files&'+type+'='+file;
 		$('#linkText').val(link);
 		$('#linkText').show('blind');
 		$('#showPassword').show();