Compare to 0 to get the desired result

This commit is contained in:
Sebastiaan Janssen
2019-04-18 12:37:52 +02:00
parent 1e475bfc6f
commit 74f98d51cd

View File

@@ -166,8 +166,8 @@ function treeService($q, treeResource, iconHelper, notificationsService, eventsS
angular.isArray(Umbraco.Sys.ServerVariables.umbracoPlugins.trees)) {
var found = _.find(Umbraco.Sys.ServerVariables.umbracoPlugins.trees, function (item) {
// localeCompare returns 0 when strings are equal so we need to add one to make it true.
return item.alias.localeCompare(treeAlias, undefined, { ignorePunctuation: true }) + 1;
// localeCompare returns 0 when strings are equal, so return false if there's no match
return item.alias.localeCompare(treeAlias, undefined, { ignorePunctuation: true }) !== 0;
});
return found ? found.packageFolder : undefined;