1
0
mirror of https://github.com/bitwarden/server synced 2025-12-16 16:23:31 +00:00

fix cipher attachment saving on EF repos (#2365)

This commit is contained in:
Kyle Spearrin
2022-10-26 11:20:10 -04:00
committed by GitHub
parent 351f62866b
commit 20ddd9ae8c
2 changed files with 9 additions and 7 deletions

View File

@@ -124,8 +124,8 @@ public abstract class BaseEntityFrameworkRepository
!string.IsNullOrWhiteSpace(e.Attachments))
.Select(e => e.Attachments)
.ToListAsync();
var storage = attachments.Sum(e => JsonDocument.Parse(e)?.RootElement.EnumerateArray()
.Sum(p => p.GetProperty("Size").GetInt64()) ?? 0);
var storage = attachments.Sum(e => JsonDocument.Parse(e)?.RootElement.EnumerateObject()
.Sum(p => p.Value.GetProperty("Size").GetInt64()) ?? 0);
var organization = new Organization
{
Id = organizationId,
@@ -152,8 +152,8 @@ public abstract class BaseEntityFrameworkRepository
!string.IsNullOrWhiteSpace(e.Attachments))
.Select(e => e.Attachments)
.ToListAsync();
var storage = attachments.Sum(e => JsonDocument.Parse(e)?.RootElement.EnumerateArray()
.Sum(p => p.GetProperty("Size").GetInt64()) ?? 0);
var storage = attachments.Sum(e => JsonDocument.Parse(e)?.RootElement.EnumerateObject()
.Sum(p => p.Value.GetProperty("Size").GetInt64()) ?? 0);
var user = new Models.User
{
Id = userId,