1
0
mirror of https://github.com/bitwarden/mobile synced 2026-01-05 01:53:17 +00:00

conditions around opening file

This commit is contained in:
Kyle Spearrin
2017-07-13 09:01:00 -04:00
parent eec4be1845
commit fe5cc1f8f3
22 changed files with 251 additions and 158 deletions

View File

@@ -13,7 +13,7 @@ namespace Bit.App.Models
Id = data.Id;
Url = data.Url;
FileName = data.FileName != null ? new CipherString(data.FileName) : null;
Size = data.Size;
SetSize(data.Size);
SizeName = data.SizeName;
}
@@ -22,19 +22,30 @@ namespace Bit.App.Models
Id = response.Id;
Url = response.Url;
FileName = response.FileName != null ? new CipherString(response.FileName) : null;
Size = response.Size;
SetSize(response.Size);
SizeName = response.SizeName;
}
public string Id { get; set; }
public string Url { get; set; }
public CipherString FileName { get; set; }
public string Size { get; set; }
public long Size { get; set; }
public string SizeName { get; set; }
public AttachmentData ToAttachmentData(string loginId)
{
return new AttachmentData(this, loginId);
}
private void SetSize(string sizeString)
{
long size;
if(!long.TryParse(sizeString, out size))
{
size = 0;
}
Size = size;
}
}
}

View File

@@ -16,7 +16,7 @@ namespace Bit.App.Models.Data
LoginId = loginId;
Url = attachment.Url;
FileName = attachment.FileName?.EncryptedString;
Size = attachment.Size;
Size = attachment.Size.ToString();
SizeName = attachment.SizeName;
}

View File

@@ -223,7 +223,8 @@ namespace Bit.App.Models.Page
{
Id = attachment.Id,
Name = attachment.FileName?.Decrypt(login.OrganizationId),
Size = attachment.SizeName,
SizeName = attachment.SizeName,
Size = attachment.Size,
Url = attachment.Url
});
}
@@ -239,7 +240,8 @@ namespace Bit.App.Models.Page
{
public string Id { get; set; }
public string Name { get; set; }
public string Size { get; set; }
public string SizeName { get; set; }
public long Size { get; set; }
public string Url { get; set; }
}
}