improvement: If decodign a cipher fails, prefer the last local copy over a remote one

This commit is contained in:
Artem Chepurnoy 2024-03-09 08:50:39 +02:00
parent 5ea143bdb9
commit 4651a45216
No known key found for this signature in database
GPG Key ID: FAC37D0CF674043E
1 changed files with 5 additions and 5 deletions

View File

@ -317,7 +317,7 @@ class SyncEngine(
deleted = false, deleted = false,
version = BitwardenService.VERSION, version = BitwardenService.VERSION,
) )
val model = BitwardenFolder( val model = localOrNull?.copy(service = service) ?: BitwardenFolder(
accountId = user.id, accountId = user.id,
folderId = localId, folderId = localId,
revisionDate = remote.revisionDate, revisionDate = remote.revisionDate,
@ -543,7 +543,7 @@ class SyncEngine(
deleted = false, deleted = false,
version = BitwardenService.VERSION, version = BitwardenService.VERSION,
) )
val model = BitwardenCipher( val model = localOrNull?.copy(service = service) ?: BitwardenCipher(
accountId = user.id, accountId = user.id,
cipherId = localId, cipherId = localId,
folderId = folderId, folderId = folderId,
@ -768,7 +768,7 @@ class SyncEngine(
deleted = false, deleted = false,
version = BitwardenService.VERSION, version = BitwardenService.VERSION,
) )
val model = BitwardenCollection( val model = localOrNull?.copy(service = service) ?: BitwardenCollection(
accountId = user.id, accountId = user.id,
collectionId = remote.id, collectionId = remote.id,
externalId = remote.externalId, externalId = remote.externalId,
@ -883,7 +883,7 @@ class SyncEngine(
deleted = false, deleted = false,
version = BitwardenService.VERSION, version = BitwardenService.VERSION,
) )
val model = BitwardenOrganization( val model = localOrNull?.copy(service = service) ?: BitwardenOrganization(
accountId = user.id, accountId = user.id,
organizationId = remote.id, organizationId = remote.id,
revisionDate = now, revisionDate = now,
@ -1001,7 +1001,7 @@ class SyncEngine(
deleted = false, deleted = false,
version = BitwardenService.VERSION, version = BitwardenService.VERSION,
) )
val model = BitwardenSend( val model = localOrNull?.copy(service = service) ?: BitwardenSend(
accountId = user.id, accountId = user.id,
sendId = localOrNull?.sendId ?: cryptoGenerator.uuid(), sendId = localOrNull?.sendId ?: cryptoGenerator.uuid(),
revisionDate = now, revisionDate = now,