1
0
mirror of https://github.com/bitwarden/server.git synced 2024-11-21 12:05:42 +01:00

[PM-4252] Change attachment Size to be represented as a string (#3335)

This commit is contained in:
Oscar Hinton 2023-10-23 16:56:04 +02:00 committed by GitHub
parent 19e2215376
commit 18b43130e8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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<AttachmentResponseModel> FromCipher(Cipher cipher, IGlobalSettings globalSettings)