1
0
mirror of https://github.com/bitwarden/server.git synced 2025-07-07 02:52:50 -05:00

delete attachments

This commit is contained in:
Kyle Spearrin
2017-07-07 11:07:22 -04:00
parent d3c18381f9
commit 43262e577c
9 changed files with 155 additions and 18 deletions

View File

@ -26,21 +26,13 @@ namespace Bit.Core.Models.Api
public static IEnumerable<AttachmentResponseModel> FromCipher(Cipher cipher, GlobalSettings globalSettings)
{
if(string.IsNullOrWhiteSpace(cipher.Attachments))
var attachments = cipher.GetAttachments();
if(attachments == null)
{
return null;
}
try
{
var attachments =
JsonConvert.DeserializeObject<Dictionary<string, CipherAttachment.MetaData>>(cipher.Attachments);
return attachments.Select(a => new AttachmentResponseModel(a.Key, a.Value, cipher, globalSettings));
}
catch
{
return null;
}
return attachments.Select(a => new AttachmentResponseModel(a.Key, a.Value, cipher, globalSettings));
}
}
}