1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-11-23 11:56:00 +01:00

importer fixes

This commit is contained in:
Kyle Spearrin 2019-11-26 08:34:45 -05:00
parent d1c0776330
commit 68bbc8434f
3 changed files with 16 additions and 9 deletions

View File

@ -32,6 +32,7 @@ export class CodebookCsvImporter extends BaseImporter implements Importer {
this.processKvp(cipher, 'Account', value.Account);
this.processKvp(cipher, 'Date', value.Date);
this.convertToNoteIfNeeded(cipher);
this.cleanupCipher(cipher);
result.ciphers.push(cipher);
});

View File

@ -74,8 +74,9 @@ export class KeePass2XmlImporter extends BaseImporter implements Importer {
cipher.notes += (value + '\n');
} else {
let type = FieldType.Text;
if (valueEl.attributes.length > 0 && valueEl.attributes['ProtectInMemory'] != null &&
valueEl.attributes['ProtectInMemory'].value === 'True') {
const attrs = (valueEl.attributes as any);
if (attrs.length > 0 && attrs.ProtectInMemory != null &&
attrs.ProtectInMemory.value === 'True') {
type = FieldType.Hidden;
}
this.processKvp(cipher, key, value, type);

View File

@ -54,6 +54,9 @@ export class OnePassword1PifImporter extends BaseImporter implements Importer {
}
if (item.details != null) {
if (item.details.passwordHistory != null) {
this.parsePasswordHistory(item.details.passwordHistory, cipher);
}
if (!this.isNullOrWhitespace(item.details.ccnum) || !this.isNullOrWhitespace(item.details.cvv)) {
cipher.type = CipherType.Card;
cipher.card = new CardView();
@ -78,9 +81,6 @@ export class OnePassword1PifImporter extends BaseImporter implements Importer {
}
});
}
if (item.details.passwordHistory != null) {
this.parsePasswordHistory(item.details.passwordHistory, cipher);
}
}
}
@ -103,6 +103,9 @@ export class OnePassword1PifImporter extends BaseImporter implements Importer {
}
if (item.secureContents != null) {
if (item.secureContents.passwordHistory != null) {
this.parsePasswordHistory(item.secureContents.passwordHistory, cipher);
}
if (!this.isNullOrWhitespace(item.secureContents.notesPlain)) {
cipher.notes = item.secureContents.notesPlain.split(this.newLineRegex).join('\n') + '\n';
}
@ -132,9 +135,6 @@ export class OnePassword1PifImporter extends BaseImporter implements Importer {
}
});
}
if (item.secureContents.passwordHistory != null) {
this.parsePasswordHistory(item.secureContents.passwordHistory, cipher);
}
}
}
@ -232,8 +232,13 @@ export class OnePassword1PifImporter extends BaseImporter implements Importer {
}
}
const fieldType = field.k === 'concealed' ? FieldType.Hidden : FieldType.Text;
const fieldName = this.isNullOrWhitespace(field[nameKey]) ? 'no_name' : field[nameKey];
if (fieldName === 'password' && cipher.passwordHistory != null &&
cipher.passwordHistory.some((h) => h.password === fieldValue)) {
return;
}
const fieldType = field.k === 'concealed' ? FieldType.Hidden : FieldType.Text;
this.processKvp(cipher, fieldName, fieldValue, fieldType);
});
}