Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 1 commit into from
Oct 23, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 4 additions & 6 deletions src/Api/Vault/Models/Response/AttachmentResponseModel.cs
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -15,7 +14,7 @@ public AttachmentResponseModel(AttachmentResponseData data) : base("attachment")
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);
}

Expand All @@ -27,16 +26,15 @@ public AttachmentResponseModel(string id, CipherAttachment.MetaData data, Cipher
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);
}

public string Id { get; set; }
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)
Expand Down