Skip to content

Commit

Permalink
Storage: Account for malformed team names in loading comparisons
Browse files Browse the repository at this point in the history
  • Loading branch information
mia-pi-git committed Oct 23, 2023
1 parent afbb31d commit 65d387a
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions js/storage.js
Original file line number Diff line number Diff line change
Expand Up @@ -601,7 +601,7 @@ Storage.compareTeams = function (serverTeam, localTeam) {
}
}
var sanitize = function (name) {
return (name || "").replace(' (server version)', '').trim();
return (name || "").replace(/\s+\(server version\)/g, '').trim();
};
var nameMatches = sanitize(serverTeam.name) === sanitize(localTeam.name);
if (!(nameMatches && serverTeam.format === localTeam.format)) {
Expand Down Expand Up @@ -633,7 +633,9 @@ Storage.loadRemoteTeams = function (after) {
}
if (match === 'rename') {
delete curTeam.teamid;
team.name += ' (server version)';
if (!team.name.endsWith(' (server version)')) {
team.name += ' (server version)';
}
}
}
team.loaded = false;
Expand Down

0 comments on commit 65d387a

Please sign in to comment.