diff --git a/apps/files_sharing/js/share.js b/apps/files_sharing/js/share.js
index 3834ebbf83250efa01960317cdc8d8d45acbdf7c..fed85b35b536b8aa3bdf1a66313b14052cc55b20 100644
--- a/apps/files_sharing/js/share.js
+++ b/apps/files_sharing/js/share.js
@@ -161,8 +161,7 @@ function createShareDropdown(filenames, files) {
 			var list;
 			$.each(users, function(index, row) {
 				$('#uid_shared_with option[value="'+row.uid_shared_with+'"]').remove();
-				if (typeof(index) == 'string') {
-					// TODO typeof not always working, group together users that have parent folders shared with them
+				if (isNaN(index)) {
 					list += "<li>Parent folder "+index.substr(0, index.lastIndexOf('-'))+" shared with "+row.uid_shared_with+"</li>";
 				} else {
 					list += "<li data-uid_shared_with='"+row.uid_shared_with+"'>";