Do not export items that have been deleted (#1200)

This commit is contained in:
Matt Gibson 2020-12-29 11:38:12 -06:00 committed by GitHub
parent 201191e96d
commit bd3fdcab26
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -34,14 +34,15 @@ namespace Bit.Core.Services
if (format == "encrypted_json")
{
var folders = (await _folderService.GetAllAsync()).Where(f => f.Id != null).Select(f => new FolderWithId(f));
var items = (await _cipherService.GetAllAsync()).Where(c => c.OrganizationId == null).Select(c => new CipherWithId(c));
var items = (await _cipherService.GetAllAsync()).Where(c => c.OrganizationId == null && c.DeletedDate == null)
.Select(c => new CipherWithId(c));
return ExportEncryptedJson(folders, items);
}
else
{
var decryptedFolders = await _folderService.GetAllDecryptedAsync();
var decryptedCiphers = await _cipherService.GetAllDecryptedAsync();
var decryptedCiphers = (await _cipherService.GetAllDecryptedAsync()).Where(c => c.DeletedDate == null);
return format == "csv" ? ExportCsv(decryptedFolders, decryptedCiphers) : ExportJson(decryptedFolders, decryptedCiphers);
}