mirror of
https://github.com/bitwarden/server.git
synced 2024-11-25 12:45:18 +01:00
[Hotfix] Fix attachment download (#1841)
This commit is contained in:
parent
cd61c826f9
commit
f56d2ecae5
@ -717,7 +717,7 @@ namespace Bit.Api.Controllers
|
||||
var userId = _userService.GetProperUserId(User).Value;
|
||||
var cipher = await _cipherRepository.GetByIdAsync(new Guid(id), userId);
|
||||
var result = await _cipherService.GetAttachmentDownloadDataAsync(cipher, attachmentId);
|
||||
return new AttachmentResponseModel(result.Id, result.Data, result.Cipher, _globalSettings);
|
||||
return new AttachmentResponseModel(result);
|
||||
}
|
||||
|
||||
[HttpPost("{id}/attachment/{attachmentId}/share")]
|
||||
|
@ -175,7 +175,7 @@ namespace Bit.Api.Controllers
|
||||
var user = await _userService.GetUserByPrincipalAsync(User);
|
||||
var result =
|
||||
await _emergencyAccessService.GetAttachmentDownloadAsync(new Guid(id), cipherId, attachmentId, user);
|
||||
return new AttachmentResponseModel(result.Id, result.Data, result.Cipher, _globalSettings);
|
||||
return new AttachmentResponseModel(result);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -11,6 +11,16 @@ namespace Bit.Api.Models.Response
|
||||
{
|
||||
public class AttachmentResponseModel : ResponseModel
|
||||
{
|
||||
public AttachmentResponseModel(AttachmentResponseData data) : base("attachment")
|
||||
{
|
||||
Id = data.Id;
|
||||
Url = data.Url;
|
||||
FileName = data.Data.FileName;
|
||||
Key = data.Data.Key;
|
||||
Size = data.Data.Size;
|
||||
SizeName = CoreHelpers.ReadableBytesSize(data.Data.Size);
|
||||
}
|
||||
|
||||
public AttachmentResponseModel(string id, CipherAttachment.MetaData data, Cipher cipher,
|
||||
IGlobalSettings globalSettings)
|
||||
: base("attachment")
|
||||
|
Loading…
Reference in New Issue
Block a user