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

validate send model parameters (#1067)

This commit is contained in:
Kyle Spearrin
2020-12-30 16:25:00 -05:00
committed by GitHub
parent 4825998ba5
commit d96da37e2a
2 changed files with 20 additions and 0 deletions

View File

@ -84,6 +84,7 @@ namespace Bit.Api.Controllers
[HttpPost("")]
public async Task<SendResponseModel> Post([FromBody] SendRequestModel model)
{
model.ValidateCreation();
var userId = _userService.GetProperUserId(User).Value;
var send = model.ToSend(userId, _sendService);
await _sendService.SaveSendAsync(send);
@ -108,6 +109,7 @@ namespace Bit.Api.Controllers
Send send = null;
await Request.GetSendFileAsync(async (stream, fileName, model) =>
{
model.ValidateCreation();
var userId = _userService.GetProperUserId(User).Value;
var (madeSend, madeData) = model.ToSend(userId, fileName, _sendService);
send = madeSend;