store large items in notes for import

This commit is contained in:
Kyle Spearrin 2017-11-28 10:02:41 -05:00
parent b411176c8d
commit 0482ddea2c
1 changed files with 117 additions and 34 deletions

View File

@ -738,6 +738,9 @@
else if (type === 'weblogin' || type === 'website') { else if (type === 'weblogin' || type === 'website') {
cipher.login.uri = trimUri(text); cipher.login.uri = trimUri(text);
} }
else if (text.length > 200) {
cipher.notes += (name + ': ' + text + '\n');
}
else { else {
if (!cipher.fields) { if (!cipher.fields) {
cipher.fields = []; cipher.fields = [];
@ -970,16 +973,25 @@
cipher.notes = cipher.notes === null ? value + '\n' : cipher.notes + value + '\n'; cipher.notes = cipher.notes === null ? value + '\n' : cipher.notes + value + '\n';
break; break;
default: default:
if (!cipher.fields) { if (value.length > 200 || value.indexOf('\n') > -1) {
cipher.fields = []; if (!cipher.notes) {
} cipher.notes = '';
}
// other custom fields cipher.notes += (key + ': ' + value + '\n');
cipher.fields.push({ }
name: key, else {
value: value, if (!cipher.fields) {
type: constants.fieldType.text cipher.fields = [];
}); }
// other custom fields
cipher.fields.push({
name: key,
value: value,
type: constants.fieldType.text
});
}
break; break;
} }
} }
@ -1106,7 +1118,7 @@
} }
else if (fieldValue) { else if (fieldValue) {
var fieldName = (field[nameKey] || 'no_name'); var fieldName = (field[nameKey] || 'no_name');
if (fieldValue.indexOf('\\n') > -1) { if (fieldValue.indexOf('\\n') > -1 || fieldValue.length > 200) {
if (cipher.notes === null) { if (cipher.notes === null) {
cipher.notes = ''; cipher.notes = '';
} }
@ -1434,14 +1446,25 @@
if (value.length > 6) { if (value.length > 6) {
// we have some custom fields. // we have some custom fields.
cipher.fields = [];
for (i = 6; i < value.length; i = i + 2) { for (i = 6; i < value.length; i = i + 2) {
cipher.fields.push({ if (value[i + 1].length > 200) {
name: value[i], if (!cipher.notes) {
value: value[i + 1], cipher.notes = '';
type: constants.fieldType.text }
});
cipher.notes += (value[i] + ': ' + value[i + 1] + '\n');
}
else {
if (!cipher.fields) {
cipher.fields = [];
}
cipher.fields.push({
name: value[i],
value: value[i + 1],
type: constants.fieldType.text
});
}
} }
} }
@ -1549,15 +1572,24 @@
continue; continue;
} }
if (!cipher.fields) { if (attrValue.length > 200) {
cipher.fields = []; if (!cipher.notes) {
} cipher.notes = '';
}
cipher.fields.push({ cipher.notes += (attrName + ': ' + attrValue + '\n');
name: attrName, }
value: attrValue, else {
type: constants.fieldType.text if (!cipher.fields) {
}); cipher.fields = [];
}
cipher.fields.push({
name: attrName,
value: attrValue,
type: constants.fieldType.text
});
}
} }
} }
@ -1642,6 +1674,13 @@
else if (fieldLower === 'totp' && !cipher.login.totp) { else if (fieldLower === 'totp' && !cipher.login.totp) {
cipher.login.totp = value; cipher.login.totp = value;
} }
else if (value.length > 200) {
if (!cipher.notes) {
cipher.notes = '';
}
cipher.notes += (field + ': ' + value + '\n');
}
else { else {
// other fields // other fields
if (!cipher.fields) { if (!cipher.fields) {
@ -2132,16 +2171,25 @@
for (var property in value) { for (var property in value) {
if (value.hasOwnProperty(property) && propsToIgnore.indexOf(property.toLowerCase()) < 0 && if (value.hasOwnProperty(property) && propsToIgnore.indexOf(property.toLowerCase()) < 0 &&
value[property] && value[property] !== '') { value[property] && value[property] !== '') {
if (!cipher.fields) { if (value[property].length > 200) {
cipher.fields = []; if (!cipher.notes) {
} cipher.notes = '';
}
// other custom fields cipher.notes += (property + ': ' + value[property] + '\n');
cipher.fields.push({ }
name: property, else {
value: value[property], if (!cipher.fields) {
type: constants.fieldType.text cipher.fields = [];
}); }
// other custom fields
cipher.fields.push({
name: property,
value: value[property],
type: constants.fieldType.text
});
}
} }
} }
} }
@ -2213,6 +2261,13 @@
else if (!cipher.login.password && isField(field.label, _passwordFieldNames)) { else if (!cipher.login.password && isField(field.label, _passwordFieldNames)) {
cipher.login.password = field.value; cipher.login.password = field.value;
} }
else if (field.value.length > 200) {
if (!cipher.notes) {
cipher.notes = '';
}
cipher.notes += (field.label + ': ' + field.value + '\n');
}
else { else {
if (!cipher.fields) { if (!cipher.fields) {
cipher.fields = []; cipher.fields = [];
@ -2340,6 +2395,13 @@
else if (!cipher.login.username && isField(field.replace(':', ''), _usernameFieldNames)) { else if (!cipher.login.username && isField(field.replace(':', ''), _usernameFieldNames)) {
cipher.login.username = fieldValue; cipher.login.username = fieldValue;
} }
else if (fieldValue.length > 200) {
if (!cipher.notes) {
cipher.notes = '';
}
cipher.notes += (field + ': ' + fieldValue + '\n');
}
else { else {
if (!cipher.fields) { if (!cipher.fields) {
cipher.fields = []; cipher.fields = [];
@ -2452,6 +2514,13 @@
else if (!cipher.login.password && isField(field, _passwordFieldNames)) { else if (!cipher.login.password && isField(field, _passwordFieldNames)) {
cipher.login.password = value; cipher.login.password = value;
} }
else if (value.length > 200) {
if (!cipher.notes) {
cipher.notes = '';
}
cipher.notes += (field + ': ' + value + '\n');
}
else { else {
if (!cipher.fields) { if (!cipher.fields) {
cipher.fields = []; cipher.fields = [];
@ -2522,6 +2591,13 @@
else if (property === 'password') { else if (property === 'password') {
cipher.login.password = value; cipher.login.password = value;
} }
else if (value.length > 200) {
if (!cipher.notes) {
cipher.notes = '';
}
cipher.notes += (property + ': ' + value + '\n');
}
else { else {
if (!cipher.fields) { if (!cipher.fields) {
cipher.fields = []; cipher.fields = [];
@ -2575,6 +2651,13 @@
else if (fieldLower === 'password') { else if (fieldLower === 'password') {
cipher.login.password = value; cipher.login.password = value;
} }
else if (value.length > 200) {
if (!cipher.notes) {
cipher.notes = '';
}
cipher.notes += (field + ': ' + value + '\n');
}
else { else {
if (!cipher.fields) { if (!cipher.fields) {
cipher.fields = []; cipher.fields = [];