Privacy-first password manager with built-in email aliasing. Fully encrypted and self-hostable.
Update clone logic (#2159)
Leendert de Borst6712e9fafec5
diff --git a/apps/server/AliasVault.Client/Main/Models/ItemEdit.cs b/apps/server/AliasVault.Client/Main/Models/ItemEdit.csindex 64f8c3300..63bb89d1d 100644--- a/apps/server/AliasVault.Client/Main/Models/ItemEdit.cs+++ b/apps/server/AliasVault.Client/Main/Models/ItemEdit.cs@@ -583,6 +583,7 @@ public sealed class ItemEditreturn new Attachment{Id = attachment.Id,+ ManifestId = attachment.ManifestId,Filename = attachment.Filename ?? string.Empty,Blob = attachment.Blob ?? [],ItemId = attachment.ItemId,@@ -602,8 +603,12 @@ public sealed class ItemEditreturn new TotpCode{Id = totpCode.Id,+ ManifestId = totpCode.ManifestId,Name = totpCode.Name,SecretKey = totpCode.SecretKey,+ Algorithm = totpCode.Algorithm,+ Digits = totpCode.Digits,+ Period = totpCode.Period,ItemId = totpCode.ItemId,CreatedAt = totpCode.CreatedAt,UpdatedAt = totpCode.UpdatedAt,@@ -621,6 +626,7 @@ public sealed class ItemEditreturn new Passkey{Id = passkey.Id,+ ManifestId = passkey.ManifestId,RpId = passkey.RpId,UserHandle = passkey.UserHandle,PublicKey = passkey.PublicKey,diff --git a/apps/server/AliasVault.Client/Services/ItemService.cs b/apps/server/AliasVault.Client/Services/ItemService.csindex bc89b6a6e..d4fc1c14c 100644--- a/apps/server/AliasVault.Client/Services/ItemService.cs+++ b/apps/server/AliasVault.Client/Services/ItemService.cs@@ -426,6 +426,9 @@ public sealed class ItemService(HttpClient httpClient, DbService dbService, ConfId = Guid.NewGuid(),Name = totpCode.Name,SecretKey = totpCode.SecretKey,+ Algorithm = totpCode.Algorithm,+ Digits = totpCode.Digits,+ Period = totpCode.Period,ItemId = newItem.Id,};SetInsertTimestamps(newTotpCode, currentDateTime);@@ -1437,7 +1440,7 @@ public sealed class ItemService(HttpClient httpClient, DbService dbService, ConfattachmentToRemove.Blob = Array.Empty<byte>();}- // Process attachments from the new item (excluding deleted ones - they're handled above)+ // Process attachments from the new item (excluding deleted ones, which are handled above)foreach (var attachment in newItem.Attachments.Where(a => !a.IsDeleted)){if (attachment.Id != Guid.Empty)@@ -1445,7 +1448,9 @@ public sealed class ItemService(HttpClient httpClient, DbService dbService, Confvar existingAttachment = existingItem.Attachments.FirstOrDefault(a => a.Id == attachment.Id);if (existingAttachment != null){- context.Entry(existingAttachment).CurrentValues.SetValues(attachment);+ // Copy the editable columns only.+ existingAttachment.Filename = attachment.Filename;+ existingAttachment.Blob = attachment.Blob;existingAttachment.UpdatedAt = updateDateTime;}}@@ -1495,7 +1500,12 @@ public sealed class ItemService(HttpClient httpClient, DbService dbService, Confvar existingTotpCode = existingItem.TotpCodes.FirstOrDefault(t => t.Id == totpCode.Id);if (existingTotpCode != null){- context.Entry(existingTotpCode).CurrentValues.SetValues(totpCode);+ // Copy the editable columns only.+ existingTotpCode.Name = totpCode.Name;+ existingTotpCode.SecretKey = totpCode.SecretKey;+ existingTotpCode.Algorithm = totpCode.Algorithm;+ existingTotpCode.Digits = totpCode.Digits;+ existingTotpCode.Period = totpCode.Period;existingTotpCode.UpdatedAt = updateDateTime;}}@@ -1508,6 +1518,9 @@ public sealed class ItemService(HttpClient httpClient, DbService dbService, ConfItemId = existingItem.Id,Name = totpCode.Name,SecretKey = totpCode.SecretKey,+ Algorithm = totpCode.Algorithm,+ Digits = totpCode.Digits,+ Period = totpCode.Period,CreatedAt = updateDateTime,UpdatedAt = updateDateTime,IsDeleted = false,