Skip to content

Privacy-first password manager with built-in email aliasing. Fully encrypted and self-hostable.

Update credential update logic to save all new attachments (#311)

Leendert de Borst5f4290add119
diff --git a/src/AliasVault.Client/Services/CredentialService.cs b/src/AliasVault.Client/Services/CredentialService.cs
index 7340341fc..a9edf4920 100644
--- a/src/AliasVault.Client/Services/CredentialService.cs
+++ b/src/AliasVault.Client/Services/CredentialService.cs
@@ -239,11 +239,14 @@ public sealed class CredentialService(HttpClient httpClient, DbService dbService
// Update existing attachments and add new ones
foreach (var attachment in loginObject.Attachments)
{
- var existingAttachment = login.Attachments.FirstOrDefault(a => a.Id == attachment.Id);
- if (existingAttachment != null)
+ if (attachment.Id != Guid.Empty)
{
- // Update existing attachment
- context.Entry(existingAttachment).CurrentValues.SetValues(attachment);
+ var existingAttachment = login.Attachments.FirstOrDefault(a => a.Id == attachment.Id);
+ if (existingAttachment != null)
+ {
+ // Update existing attachment
+ context.Entry(existingAttachment).CurrentValues.SetValues(attachment);
+ }
}
else
{