Skip to content
This repository has been archived by the owner on Jun 17, 2022. It is now read-only.

Commit

Permalink
support old CSV format for password agent
Browse files Browse the repository at this point in the history
  • Loading branch information
kspearrin committed Jun 21, 2019
1 parent 49a6b50 commit 6d82fb5
Showing 1 changed file with 14 additions and 7 deletions.
21 changes: 14 additions & 7 deletions src/importers/passwordAgentCsvImporter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,25 +12,32 @@ export class PasswordAgentCsvImporter extends BaseImporter implements Importer {
return result;
}

let newVersion = true;
results.forEach((value) => {
if (value.length < 9) {
if (value.length !== 5 && value.length < 9) {
return;
}
const folder = this.getValueOrDefault(value[8], '(None)');
const folderName = folder !== '(None)' ? folder.split('\\').join('/') : null;
this.processFolder(result, folderName);
const cipher = this.initLoginCipher();
cipher.notes = this.getValueOrDefault(value[3]);
cipher.name = this.getValueOrDefault(value[0], '--');
cipher.login.username = this.getValueOrDefault(value[1]);
cipher.login.password = this.getValueOrDefault(value[2]);
cipher.login.uris = this.makeUriArray(value[4]);
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;
this.processFolder(result, folderName);
cipher.notes = this.getValueOrDefault(value[3]);
cipher.login.uris = this.makeUriArray(value[4]);
}
this.convertToNoteIfNeeded(cipher);
this.cleanupCipher(cipher);
result.ciphers.push(cipher);
});

if (this.organization) {
if (newVersion && this.organization) {
this.moveFoldersToCollections(result);
}

Expand Down

0 comments on commit 6d82fb5

Please sign in to comment.