fix kvp splits on secure note mapping
This commit is contained in:
parent
fa65b5637b
commit
50d242e53a
|
@ -210,28 +210,39 @@ export class LastPassCsvImporter extends BaseImporter implements Importer {
|
||||||
const dataObj: any = {};
|
const dataObj: any = {};
|
||||||
|
|
||||||
extraParts.forEach((extraPart) => {
|
extraParts.forEach((extraPart) => {
|
||||||
const fieldParts = extraPart.split(':');
|
if (this.isNullOrWhitespace(extraPart)) {
|
||||||
if (fieldParts.length < 1 || this.isNullOrWhitespace(fieldParts[0]) ||
|
return;
|
||||||
this.isNullOrWhitespace(fieldParts[1]) || fieldParts[0] === 'NoteType') {
|
}
|
||||||
|
let key: string = null;
|
||||||
|
let val: string = null;
|
||||||
|
const colonIndex = extraPart.indexOf(':');
|
||||||
|
if (colonIndex === -1) {
|
||||||
|
key = extraPart;
|
||||||
|
} else {
|
||||||
|
key = extraPart.substring(0, colonIndex);
|
||||||
|
if (extraPart.length > colonIndex) {
|
||||||
|
val = extraPart.substring(colonIndex + 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (this.isNullOrWhitespace(key) || this.isNullOrWhitespace(val) || key === 'NoteType') {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fieldParts[0] === 'Notes') {
|
if (key === 'Notes') {
|
||||||
if (!this.isNullOrWhitespace(notes)) {
|
if (!this.isNullOrWhitespace(notes)) {
|
||||||
notes += ('\n' + fieldParts[1]);
|
notes += ('\n' + val);
|
||||||
} else {
|
} else {
|
||||||
notes = fieldParts[1];
|
notes = val;
|
||||||
}
|
}
|
||||||
} else if (map.hasOwnProperty(fieldParts[0])) {
|
} else if (map.hasOwnProperty(key)) {
|
||||||
dataObj[map[fieldParts[0]]] = fieldParts[1];
|
dataObj[map[key]] = val;
|
||||||
} else {
|
} else {
|
||||||
if (!this.isNullOrWhitespace(notes)) {
|
if (!this.isNullOrWhitespace(notes)) {
|
||||||
notes += '\n';
|
notes += '\n';
|
||||||
} else {
|
} else {
|
||||||
notes = '';
|
notes = '';
|
||||||
}
|
}
|
||||||
|
notes += (key + ': ' + val);
|
||||||
notes += (fieldParts[0] + ': ' + fieldParts[1]);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue