1
0
mirror of https://github.com/bitwarden/server.git synced 2024-12-22 16:57:36 +01:00

Verify Send file does not exist before saving file (#1515)

* Verify Send file does not exist before saving file

* Fix flaky test
This commit is contained in:
Matt Gibson 2021-08-17 09:37:00 -04:00 committed by GitHub
parent 48aa54949b
commit 1779d33a66
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 0 deletions

View File

@ -130,6 +130,11 @@ namespace Bit.Core.Services
var data = JsonConvert.DeserializeObject<SendFileData>(send.Data);
if (data.Validated)
{
throw new BadRequestException("File has already been uploaded.");
}
await _sendFileStorageService.UploadNewFileAsync(stream, send, data.Id);
if (!await ValidateSendFile(send))

View File

@ -79,6 +79,7 @@ namespace Bit.Core.Test.Services
List<ImportedOrganizationUser> newUsers)
{
org.UseDirectory = true;
org.Seats = newUsers.Count + existingUsers.Count + 1;
var reInvitedUser = existingUsers.First();
reInvitedUser.ExternalId = null;
newUsers.Add(new ImportedOrganizationUser