From 18b43130e85af54a5373f07356ae4bd3999adaa3 Mon Sep 17 00:00:00 2001 From: Oscar Hinton Date: Mon, 23 Oct 2023 16:56:04 +0200 Subject: [PATCH] [PM-4252] Change attachment Size to be represented as a string (#3335) --- .../Vault/Models/Response/AttachmentResponseModel.cs | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/Api/Vault/Models/Response/AttachmentResponseModel.cs b/src/Api/Vault/Models/Response/AttachmentResponseModel.cs index c7e3caabb9..f3c0261e98 100644 --- a/src/Api/Vault/Models/Response/AttachmentResponseModel.cs +++ b/src/Api/Vault/Models/Response/AttachmentResponseModel.cs @@ -1,5 +1,4 @@ -using System.Text.Json.Serialization; -using Bit.Core.Models.Api; +using Bit.Core.Models.Api; using Bit.Core.Settings; using Bit.Core.Utilities; using Bit.Core.Vault.Entities; @@ -15,7 +14,7 @@ public class AttachmentResponseModel : ResponseModel Url = data.Url; FileName = data.Data.FileName; Key = data.Data.Key; - Size = data.Data.Size; + Size = data.Data.Size.ToString(); SizeName = CoreHelpers.ReadableBytesSize(data.Data.Size); } @@ -27,7 +26,7 @@ public class AttachmentResponseModel : ResponseModel Url = $"{globalSettings.Attachment.BaseUrl}/{cipher.Id}/{id}"; FileName = data.FileName; Key = data.Key; - Size = data.Size; + Size = data.Size.ToString(); SizeName = CoreHelpers.ReadableBytesSize(data.Size); } @@ -35,8 +34,7 @@ public class AttachmentResponseModel : ResponseModel public string Url { get; set; } public string FileName { get; set; } public string Key { get; set; } - [JsonNumberHandling(JsonNumberHandling.AllowReadingFromString | JsonNumberHandling.WriteAsString)] - public long Size { get; set; } + public string Size { get; set; } public string SizeName { get; set; } public static IEnumerable FromCipher(Cipher cipher, IGlobalSettings globalSettings)