mirror of
https://github.com/bitwarden/server
synced 2025-12-17 16:53:23 +00: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:
@@ -562,7 +562,8 @@ public class CipherRepository : Repository<Core.Entities.Cipher, Cipher, Guid>,
|
|||||||
var attachments = string.IsNullOrWhiteSpace(cipher.Attachments) ?
|
var attachments = string.IsNullOrWhiteSpace(cipher.Attachments) ?
|
||||||
new Dictionary<string, CipherAttachment.MetaData>() :
|
new Dictionary<string, CipherAttachment.MetaData>() :
|
||||||
JsonConvert.DeserializeObject<Dictionary<string, CipherAttachment.MetaData>>(cipher.Attachments);
|
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);
|
cipher.Attachments = JsonConvert.SerializeObject(attachments);
|
||||||
await dbContext.SaveChangesAsync();
|
await dbContext.SaveChangesAsync();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user