Skip to content

Commit

Permalink
Remove default request size limit for direct uploads (#1406)
Browse files Browse the repository at this point in the history
* Remove default request size limit - direct upload

* Disable size limit for self-hosted attachments
  • Loading branch information
eliykat committed Jun 25, 2021
1 parent 61e4119 commit ee1223b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/Api/Controllers/CiphersController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -622,6 +622,7 @@ public async Task<AttachmentUploadDataResponseModel> RenewFileUploadUrl(string i
}

[HttpPost("{id}/attachment/{attachmentId}")]
[DisableRequestSizeLimit]
[DisableFormValueModelBinding]
public async Task PostFileForExistingAttachment(string id, string attachmentId)
{
Expand All @@ -630,6 +631,11 @@ public async Task PostFileForExistingAttachment(string id, string attachmentId)
throw new BadRequestException("Invalid content.");
}

if (!_globalSettings.SelfHosted)
{
throw new BadRequestException("Invalid endpoint for non self-hosted servers.");
}

var userId = _userService.GetProperUserId(User).Value;
var cipher = await _cipherRepository.GetByIdAsync(new Guid(id), userId);
var attachments = cipher?.GetAttachments();
Expand Down
1 change: 1 addition & 0 deletions src/Api/Controllers/SendsController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,7 @@ public async Task<SendFileUploadDataResponseModel> RenewFileUpload(string id, st
}

[HttpPost("{id}/file/{fileId}")]
[DisableRequestSizeLimit]
[DisableFormValueModelBinding]
public async Task PostFileForExistingSend(string id, string fileId)
{
Expand Down

0 comments on commit ee1223b

Please sign in to comment.