Cloud sync: check for duplicate uuids

This commit is contained in:
M66B 2023-08-17 20:32:38 +02:00
parent eb2aa5821f
commit cf16aa0c4e
1 changed files with 15 additions and 0 deletions

View File

@ -258,12 +258,21 @@ public class CloudSync {
if (accounts == null || accounts.size() == 0)
return;
List<String> uuidAccounts = new ArrayList<>();
List<String> uuidIdentities = new ArrayList<>();
JSONArray jupload = new JSONArray();
JSONArray jaccountuuidlist = new JSONArray();
for (EntityAccount account : accounts)
if (account.synchronize && !TextUtils.isEmpty(account.uuid) &&
account.auth_type != ServiceAuthenticator.AUTH_TYPE_GMAIL) {
if (uuidAccounts.contains(account.uuid)) {
Log.w("Duplicate account uuid=" + account.uuid);
continue;
} else
uuidAccounts.add(account.uuid);
jaccountuuidlist.put(account.uuid);
JSONArray jidentitieuuids = new JSONArray();
@ -271,6 +280,12 @@ public class CloudSync {
if (identities != null)
for (EntityIdentity identity : identities)
if (identity.synchronize && !TextUtils.isEmpty(identity.uuid)) {
if (uuidIdentities.contains(identity.uuid)) {
Log.w("Duplicate identity uuid=" + identity.uuid);
continue;
} else
uuidIdentities.add(identity.uuid);
jidentitieuuids.put(identity.uuid);
JSONObject jidentity = identity.toJSON();