From ee91cfc2dfda974ab1ae8e0077e58998bbc6e832 Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Fri, 2 Aug 2019 09:51:00 -0400 Subject: [PATCH] password agent import updates for alt format --- src/importers/passwordAgentCsvImporter.ts | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/src/importers/passwordAgentCsvImporter.ts b/src/importers/passwordAgentCsvImporter.ts index 6095fcbb525..e1d1018368b 100644 --- a/src/importers/passwordAgentCsvImporter.ts +++ b/src/importers/passwordAgentCsvImporter.ts @@ -17,19 +17,24 @@ export class PasswordAgentCsvImporter extends BaseImporter implements Importer { if (value.length !== 5 && value.length < 9) { return; } + const altFormat = value.length === 10 && value[0] === '0'; const cipher = this.initLoginCipher(); - cipher.name = this.getValueOrDefault(value[0], '--'); - cipher.login.username = this.getValueOrDefault(value[1]); - cipher.login.password = this.getValueOrDefault(value[2]); + cipher.name = this.getValueOrDefault(value[altFormat ? 1 : 0], '--'); + cipher.login.username = this.getValueOrDefault(value[altFormat ? 2 : 1]); + cipher.login.password = this.getValueOrDefault(value[altFormat ? 3 : 2]); if (value.length === 5) { newVersion = false; cipher.notes = this.getValueOrDefault(value[4]); cipher.login.uris = this.makeUriArray(value[3]); } else { - const folder = this.getValueOrDefault(value[8], '(None)'); - const folderName = folder !== '(None)' ? folder.split('\\').join('/') : null; + const folder = this.getValueOrDefault(value[altFormat ? 9 : 8], '(None)'); + let folderName = folder !== '(None)' ? folder.split('\\').join('/') : null; + if (folderName != null) { + folderName = folder.split(' > ').join('/'); + folderName = folder.split('>').join('/'); + } this.processFolder(result, folderName); - cipher.notes = this.getValueOrDefault(value[3]); + cipher.notes = this.getValueOrDefault(value[altFormat ? 5 : 3]); cipher.login.uris = this.makeUriArray(value[4]); } this.convertToNoteIfNeeded(cipher);