support old CSV format for password agent
This commit is contained in:
parent
49a6b5046f
commit
6d82fb5bbc
|
@ -12,25 +12,32 @@ export class PasswordAgentCsvImporter extends BaseImporter implements Importer {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let newVersion = true;
|
||||||
results.forEach((value) => {
|
results.forEach((value) => {
|
||||||
if (value.length < 9) {
|
if (value.length !== 5 && value.length < 9) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const folder = this.getValueOrDefault(value[8], '(None)');
|
|
||||||
const folderName = folder !== '(None)' ? folder.split('\\').join('/') : null;
|
|
||||||
this.processFolder(result, folderName);
|
|
||||||
const cipher = this.initLoginCipher();
|
const cipher = this.initLoginCipher();
|
||||||
cipher.notes = this.getValueOrDefault(value[3]);
|
|
||||||
cipher.name = this.getValueOrDefault(value[0], '--');
|
cipher.name = this.getValueOrDefault(value[0], '--');
|
||||||
cipher.login.username = this.getValueOrDefault(value[1]);
|
cipher.login.username = this.getValueOrDefault(value[1]);
|
||||||
cipher.login.password = this.getValueOrDefault(value[2]);
|
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.convertToNoteIfNeeded(cipher);
|
||||||
this.cleanupCipher(cipher);
|
this.cleanupCipher(cipher);
|
||||||
result.ciphers.push(cipher);
|
result.ciphers.push(cipher);
|
||||||
});
|
});
|
||||||
|
|
||||||
if (this.organization) {
|
if (newVersion && this.organization) {
|
||||||
this.moveFoldersToCollections(result);
|
this.moveFoldersToCollections(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue