Skip to content

Commit

Permalink
Storage: Properly compare team names
Browse files Browse the repository at this point in the history
  • Loading branch information
mia-pi-git committed Oct 22, 2023
1 parent 0647322 commit 68a9694
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions js/storage.js
Original file line number Diff line number Diff line change
Expand Up @@ -600,8 +600,11 @@ Storage.compareTeams = function (serverTeam, localTeam) {
}
}
}
var localTeamName = localTeam.name.replace(' (server version)', '');
if (!(serverTeam.name === localTeamName && serverTeam.format === localTeam.format)) {
var sanitize = function (name) {
return (name || "").replace(' (server version)', '').trim();
};
var nameMatches = sanitize(serverTeam.name) === sanitize(localTeam.name);
if (!(nameMatches && serverTeam.format === localTeam.format)) {
return false;
}
// if it's been edited since, invalidate the team id on this one (count it as new)
Expand Down

0 comments on commit 68a9694

Please sign in to comment.