From 741e060d999c7b40e98b5b2b8afab4e43d59afcb Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Sat, 11 May 2019 20:38:07 -0400 Subject: [PATCH] fix for empty password history --- src/importers/onepassword1PifImporter.ts | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/importers/onepassword1PifImporter.ts b/src/importers/onepassword1PifImporter.ts index eb2d4d532e..3f2420a185 100644 --- a/src/importers/onepassword1PifImporter.ts +++ b/src/importers/onepassword1PifImporter.ts @@ -140,12 +140,16 @@ export class OnePassword1PifImporter extends BaseImporter implements Importer { private parsePasswordHistory(items: any[], cipher: CipherView) { const maxSize = items.length > 5 ? 5 : items.length; - cipher.passwordHistory = items.sort((a, b) => b.time - a.time).slice(0, maxSize).map((entry: any) => { - const ph = new PasswordHistoryView(); - ph.password = entry.value; - ph.lastUsedDate = new Date(entry.time * 1000); - return ph; - }); + cipher.passwordHistory = items + .filter((h: any) => !this.isNullOrWhitespace(h.value) && h.time != null) + .sort((a, b) => b.time - a.time) + .slice(0, maxSize) + .map((h: any) => { + const ph = new PasswordHistoryView(); + ph.password = h.value; + ph.lastUsedDate = new Date(h.time * 1000); + return ph; + }); } private parseFields(fields: any[], cipher: CipherView, designationKey: string, valueKey: string, nameKey: string) {