1
0
mirror of https://github.com/bitwarden/server.git synced 2024-11-25 12:45:18 +01:00

EF repos: fix attachments update (#2374)

* fix attachments update

* Update src/Infrastructure.EntityFramework/Repositories/CipherRepository.cs

Co-authored-by: Justin Baur <19896123+justindbaur@users.noreply.github.com>

* Update CipherRepository.cs

Co-authored-by: Justin Baur <19896123+justindbaur@users.noreply.github.com>
This commit is contained in:
Kyle Spearrin 2022-10-31 08:44:11 -04:00 committed by GitHub
parent 0a01051d83
commit 52b50ef0e9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -562,7 +562,8 @@ public class CipherRepository : Repository<Core.Entities.Cipher, Cipher, Guid>,
var attachments = string.IsNullOrWhiteSpace(cipher.Attachments) ?
new Dictionary<string, CipherAttachment.MetaData>() :
JsonConvert.DeserializeObject<Dictionary<string, CipherAttachment.MetaData>>(cipher.Attachments);
attachments.Add(attachment.AttachmentId, JsonConvert.DeserializeObject<CipherAttachment.MetaData>(attachment.AttachmentData));
var metaData = JsonConvert.DeserializeObject<CipherAttachment.MetaData>(attachment.AttachmentData);
attachments[attachment.AttachmentId] = metaData;
cipher.Attachments = JsonConvert.SerializeObject(attachments);
await dbContext.SaveChangesAsync();