1
0
mirror of https://github.com/bitwarden/server.git synced 2025-07-03 00:52:49 -05:00

attachment cleanup

This commit is contained in:
Kyle Spearrin
2017-07-10 20:48:06 -04:00
parent 22f1da8497
commit de8b2de8e6
4 changed files with 45 additions and 36 deletions

View File

@ -208,11 +208,7 @@ namespace Bit.Core.Services
}
catch
{
foreach(var attachment in cipher.GetAttachments())
{
await _attachmentStorageService.RollbackShareAttachmentAsync(cipher.Id, organizationId, attachment.Key);
}
await _attachmentStorageService.CleanupAsync(cipher.Id);
throw;
}
}
@ -225,6 +221,7 @@ namespace Bit.Core.Services
}
await _cipherRepository.DeleteAsync(cipher);
await _attachmentStorageService.DeleteAttachmentsForCipherAsync(cipher.Id);
// push
await _pushService.PushSyncCipherDeleteAsync(cipher);
@ -379,14 +376,12 @@ namespace Bit.Core.Services
await _attachmentStorageService.RollbackShareAttachmentAsync(cipher.Id, organizationId, attachment.Key);
}
await _attachmentStorageService.CleanupAsync(cipher.Id);
throw;
}
// commit attachment migration
foreach(var attachment in attachments)
{
await _attachmentStorageService.CommitShareAttachmentAsync(cipher.Id, organizationId, attachment.Key);
}
await _attachmentStorageService.CleanupAsync(cipher.Id);
// push
await _pushService.PushSyncCipherUpdateAsync(cipher);