mirror of
https://github.com/bitwarden/browser.git
synced 2024-11-23 11:56:00 +01:00
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;
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user