mirror of
https://github.com/bitwarden/server.git
synced 2025-07-14 22:27:32 -05:00
Fix upload limits for direct uploads (again) (#1479)
* Use constants to represent file size limits * Allow uploads of up to 500mb for self-hosted * Set nginx max body size to 505mb * Add reminder about updating nginx/proxy.conf
This commit is contained in:
@ -17,6 +17,7 @@ using Microsoft.Azure.EventGrid.Models;
|
||||
using Bit.Core.Models.Data;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Newtonsoft.Json;
|
||||
using Bit.Core;
|
||||
|
||||
namespace Bit.Api.Controllers
|
||||
{
|
||||
@ -622,7 +623,7 @@ namespace Bit.Api.Controllers
|
||||
}
|
||||
|
||||
[HttpPost("{id}/attachment/{attachmentId}")]
|
||||
[DisableRequestSizeLimit]
|
||||
[RequestSizeLimit(Constants.FileSize501mb)]
|
||||
[DisableFormValueModelBinding]
|
||||
public async Task PostFileForExistingAttachment(string id, string attachmentId)
|
||||
{
|
||||
@ -652,7 +653,7 @@ namespace Bit.Api.Controllers
|
||||
}
|
||||
|
||||
[HttpPost("{id}/attachment")]
|
||||
[RequestSizeLimit(105_906_176)]
|
||||
[RequestSizeLimit(Constants.FileSize101mb)]
|
||||
[DisableFormValueModelBinding]
|
||||
public async Task<CipherResponseModel> PostAttachment(string id)
|
||||
{
|
||||
@ -676,7 +677,7 @@ namespace Bit.Api.Controllers
|
||||
}
|
||||
|
||||
[HttpPost("{id}/attachment-admin")]
|
||||
[RequestSizeLimit(105_906_176)]
|
||||
[RequestSizeLimit(Constants.FileSize101mb)]
|
||||
[DisableFormValueModelBinding]
|
||||
public async Task<CipherMiniResponseModel> PostAttachmentAdmin(string id)
|
||||
{
|
||||
@ -709,7 +710,7 @@ namespace Bit.Api.Controllers
|
||||
}
|
||||
|
||||
[HttpPost("{id}/attachment/{attachmentId}/share")]
|
||||
[RequestSizeLimit(105_906_176)]
|
||||
[RequestSizeLimit(Constants.FileSize101mb)]
|
||||
[DisableFormValueModelBinding]
|
||||
public async Task PostAttachmentShare(string id, string attachmentId, Guid organizationId)
|
||||
{
|
||||
@ -805,7 +806,7 @@ namespace Bit.Api.Controllers
|
||||
throw new BadRequestException("Invalid content.");
|
||||
}
|
||||
|
||||
if (Request.ContentLength > 105906176) // 101 MB, give em' 1 extra MB for cushion
|
||||
if (Request.ContentLength > Constants.FileSize101mb)
|
||||
{
|
||||
throw new BadRequestException("Max file size is 100 MB.");
|
||||
}
|
||||
|
Reference in New Issue
Block a user