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
1 changed files with 3 additions and 2 deletions

View File

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