1
0
mirror of https://github.com/bitwarden/server.git synced 2025-07-02 00:22:50 -05:00

delete attachments

This commit is contained in:
Kyle Spearrin
2017-07-07 11:07:22 -04:00
parent d3c18381f9
commit 43262e577c
9 changed files with 155 additions and 18 deletions

View File

@ -20,7 +20,6 @@ namespace Bit.Api.Controllers
private readonly ICollectionCipherRepository _collectionCipherRepository;
private readonly ICipherService _cipherService;
private readonly IUserService _userService;
private readonly IAttachmentStorageService _attachmentStorageService;
private readonly CurrentContext _currentContext;
private readonly GlobalSettings _globalSettings;
@ -29,7 +28,6 @@ namespace Bit.Api.Controllers
ICollectionCipherRepository collectionCipherRepository,
ICipherService cipherService,
IUserService userService,
IAttachmentStorageService attachmentStorageService,
CurrentContext currentContext,
GlobalSettings globalSettings)
{
@ -37,7 +35,6 @@ namespace Bit.Api.Controllers
_collectionCipherRepository = collectionCipherRepository;
_cipherService = cipherService;
_userService = userService;
_attachmentStorageService = attachmentStorageService;
_currentContext = currentContext;
_globalSettings = globalSettings;
}
@ -263,10 +260,7 @@ namespace Bit.Api.Controllers
throw new NotFoundException();
}
// TODO: check and remove attachmentId from cipher in database
var storedFilename = $"{idGuid}/{attachmentId}";
await _attachmentStorageService.DeleteAttachmentAsync(storedFilename);
await _cipherService.DeleteAttachmentAsync(cipher, attachmentId, userId, false);
}
}
}