@ -8,6 +8,7 @@ using Bit.Core.Models.Api;
@@ -8,6 +8,7 @@ using Bit.Core.Models.Api;
using Bit.Core.Exceptions ;
using Bit.Core.Services ;
using Bit.Core.Context ;
using Bit.Core.Utilities ;
using Bit.Api.Utilities ;
using System.Collections.Generic ;
using Bit.Core.Models.Table ;
@ -594,7 +595,7 @@ namespace Bit.Api.Controllers
@@ -594,7 +595,7 @@ namespace Bit.Api.Controllers
throw new NotFoundException ( ) ;
}
if ( request . FileSize > CipherService . MAX_FILE_SIZE & & ! _ globalSettings . SelfHosted )
if ( request . FileSize > CipherService . MAX_FILE_SIZE )
{
throw new BadRequestException ( $"Max file size is {CipherService.MAX_FILE_SIZE_READABLE}." ) ;
}
@ -632,6 +633,7 @@ namespace Bit.Api.Controllers
@@ -632,6 +633,7 @@ namespace Bit.Api.Controllers
}
[HttpPost("{id}/attachment/{attachmentId}")]
[SelfHosted(SelfHostedOnly = true)]
[RequestSizeLimit(Constants.FileSize501mb)]
[DisableFormValueModelBinding]
public async Task PostFileForExistingAttachment ( string id , string attachmentId )
@ -641,11 +643,6 @@ namespace Bit.Api.Controllers
@@ -641,11 +643,6 @@ namespace Bit.Api.Controllers
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 ( ) ;
@ -662,6 +659,7 @@ namespace Bit.Api.Controllers
@@ -662,6 +659,7 @@ namespace Bit.Api.Controllers
}
[HttpPost("{id}/attachment")]
[Obsolete("Deprecated Attachments API", false)]
[RequestSizeLimit(Constants.FileSize101mb)]
[DisableFormValueModelBinding]
public async Task < CipherResponseModel > PostAttachment ( string id )
@ -814,11 +812,6 @@ namespace Bit.Api.Controllers
@@ -814,11 +812,6 @@ namespace Bit.Api.Controllers
{
throw new BadRequestException ( "Invalid content." ) ;
}
if ( Request . ContentLength > Constants . FileSize101mb )
{
throw new BadRequestException ( "Max file size is 100 MB." ) ;
}
}
}
}