importer fixes

This commit is contained in:
Kyle Spearrin 2019-01-03 00:08:26 -05:00
parent e408189cf9
commit c15beac789
2 changed files with 37 additions and 1 deletions

View File

@ -55,7 +55,9 @@ export class OnePassword1PifImporter extends BaseImporter implements Importer {
cipher.type = CipherType.Card;
cipher.card = new CardView();
}
if (cipher.type === CipherType.Login && !this.isNullOrWhitespace(item.details.password)) {
cipher.login.password = item.details.password;
}
if (!this.isNullOrWhitespace(item.details.notesPlain)) {
cipher.notes = item.details.notesPlain.split(this.newLineRegex).join('\n') + '\n';
}
@ -91,6 +93,22 @@ export class OnePassword1PifImporter extends BaseImporter implements Importer {
if (!this.isNullOrWhitespace(item.secureContents.notesPlain)) {
cipher.notes = item.secureContents.notesPlain.split(this.newLineRegex).join('\n') + '\n';
}
if (cipher.type === CipherType.Login) {
if (!this.isNullOrWhitespace(item.secureContents.password)) {
cipher.login.password = item.secureContents.password;
}
if (item.secureContents.URLs != null) {
const urls: string[] = [];
item.secureContents.URLs.forEach((u: any) => {
if (!this.isNullOrWhitespace(u.url)) {
urls.push(u.url);
}
});
if (urls.length > 0) {
cipher.login.uris = this.makeUriArray(urls);
}
}
}
if (item.secureContents.fields != null) {
this.parseFields(item.secureContents.fields, cipher, 'designation', 'value', 'name');
}

View File

@ -25,11 +25,29 @@ export class RoboFormCsvImporter extends BaseImporter implements Importer {
cipher.login.username = this.getValueOrDefault(value.Login);
cipher.login.password = this.getValueOrDefault(value.Pwd);
cipher.login.uris = this.makeUriArray(value.Url);
if (!this.isNullOrWhitespace(value.Rf_fields)) {
let fields: string[] = [value.Rf_fields];
if (value.__parsed_extra != null && value.__parsed_extra.length > 0) {
fields = fields.concat(value.__parsed_extra);
}
fields.forEach((field: string) => {
const parts = field.split(':');
if (parts.length < 3) {
return;
}
const key = parts[0] === '-no-name-' ? null : parts[0];
const val = parts.length === 4 && parts[2] === 'rck' ? parts[1] : parts[2];
this.processKvp(cipher, key, val);
});
}
this.cleanupCipher(cipher);
if (i === results.length && cipher.name === '--' && this.isNullOrWhitespace(cipher.login.password)) {
return;
}
result.ciphers.push(cipher);
i++;
});