mirror of
https://github.com/bitwarden/server.git
synced 2025-05-21 03:24:31 -05:00
PM-16170 removing deprecated send file endpoint (#5222)
This commit is contained in:
parent
79810b78ff
commit
95893bd0b1
@ -9,7 +9,6 @@ using Bit.Core.Context;
|
|||||||
using Bit.Core.Exceptions;
|
using Bit.Core.Exceptions;
|
||||||
using Bit.Core.Services;
|
using Bit.Core.Services;
|
||||||
using Bit.Core.Settings;
|
using Bit.Core.Settings;
|
||||||
using Bit.Core.Tools.Entities;
|
|
||||||
using Bit.Core.Tools.Enums;
|
using Bit.Core.Tools.Enums;
|
||||||
using Bit.Core.Tools.Models.Data;
|
using Bit.Core.Tools.Models.Data;
|
||||||
using Bit.Core.Tools.Repositories;
|
using Bit.Core.Tools.Repositories;
|
||||||
@ -163,32 +162,6 @@ public class SendsController : Controller
|
|||||||
return new SendResponseModel(send, _globalSettings);
|
return new SendResponseModel(send, _globalSettings);
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpPost("file")]
|
|
||||||
[Obsolete("Deprecated File Send API", false)]
|
|
||||||
[RequestSizeLimit(Constants.FileSize101mb)]
|
|
||||||
[DisableFormValueModelBinding]
|
|
||||||
public async Task<SendResponseModel> PostFile()
|
|
||||||
{
|
|
||||||
if (!Request?.ContentType.Contains("multipart/") ?? true)
|
|
||||||
{
|
|
||||||
throw new BadRequestException("Invalid content.");
|
|
||||||
}
|
|
||||||
|
|
||||||
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;
|
|
||||||
await _sendService.SaveFileSendAsync(send, madeData, model.FileLength.GetValueOrDefault(0));
|
|
||||||
await _sendService.UploadFileToExistingSendAsync(stream, send);
|
|
||||||
});
|
|
||||||
|
|
||||||
return new SendResponseModel(send, _globalSettings);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
[HttpPost("file/v2")]
|
[HttpPost("file/v2")]
|
||||||
public async Task<SendFileUploadDataResponseModel> PostFile([FromBody] SendRequestModel model)
|
public async Task<SendFileUploadDataResponseModel> PostFile([FromBody] SendRequestModel model)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user