password agent import updates for alt format
This commit is contained in:
parent
6372d24104
commit
ee91cfc2df
|
@ -17,19 +17,24 @@ export class PasswordAgentCsvImporter extends BaseImporter implements Importer {
|
||||||
if (value.length !== 5 && value.length < 9) {
|
if (value.length !== 5 && value.length < 9) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
const altFormat = value.length === 10 && value[0] === '0';
|
||||||
const cipher = this.initLoginCipher();
|
const cipher = this.initLoginCipher();
|
||||||
cipher.name = this.getValueOrDefault(value[0], '--');
|
cipher.name = this.getValueOrDefault(value[altFormat ? 1 : 0], '--');
|
||||||
cipher.login.username = this.getValueOrDefault(value[1]);
|
cipher.login.username = this.getValueOrDefault(value[altFormat ? 2 : 1]);
|
||||||
cipher.login.password = this.getValueOrDefault(value[2]);
|
cipher.login.password = this.getValueOrDefault(value[altFormat ? 3 : 2]);
|
||||||
if (value.length === 5) {
|
if (value.length === 5) {
|
||||||
newVersion = false;
|
newVersion = false;
|
||||||
cipher.notes = this.getValueOrDefault(value[4]);
|
cipher.notes = this.getValueOrDefault(value[4]);
|
||||||
cipher.login.uris = this.makeUriArray(value[3]);
|
cipher.login.uris = this.makeUriArray(value[3]);
|
||||||
} else {
|
} else {
|
||||||
const folder = this.getValueOrDefault(value[8], '(None)');
|
const folder = this.getValueOrDefault(value[altFormat ? 9 : 8], '(None)');
|
||||||
const folderName = folder !== '(None)' ? folder.split('\\').join('/') : null;
|
let folderName = folder !== '(None)' ? folder.split('\\').join('/') : null;
|
||||||
|
if (folderName != null) {
|
||||||
|
folderName = folder.split(' > ').join('/');
|
||||||
|
folderName = folder.split('>').join('/');
|
||||||
|
}
|
||||||
this.processFolder(result, folderName);
|
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]);
|
cipher.login.uris = this.makeUriArray(value[4]);
|
||||||
}
|
}
|
||||||
this.convertToNoteIfNeeded(cipher);
|
this.convertToNoteIfNeeded(cipher);
|
||||||
|
|
Loading…
Reference in New Issue