mirror of https://github.com/keeweb/keeweb.git
fix #910: removing bad characters from input
This commit is contained in:
parent
62e3068af1
commit
2820141897
|
@ -390,6 +390,7 @@ const EntryModel = Backbone.Model.extend({
|
|||
const hasValue = val && (typeof val === 'string' || val.isProtected && val.byteLength);
|
||||
if (hasValue || allowEmpty || this.builtInFields.indexOf(field) >= 0) {
|
||||
this._entryModified();
|
||||
val = this.sanitizeFieldValue(val);
|
||||
this.entry.fields[field] = val;
|
||||
} else if (this.entry.fields.hasOwnProperty(field)) {
|
||||
this._entryModified();
|
||||
|
@ -398,6 +399,15 @@ const EntryModel = Backbone.Model.extend({
|
|||
this._fillByEntry();
|
||||
},
|
||||
|
||||
sanitizeFieldValue: function(val) {
|
||||
if (val && !val.isProtected && val.indexOf('\x1A') >= 0) {
|
||||
// https://github.com/keeweb/keeweb/issues/910
|
||||
// eslint-disable-next-line no-control-regex
|
||||
val = val.replace(/\x1A/g, '');
|
||||
}
|
||||
return val;
|
||||
},
|
||||
|
||||
hasField: function(field) {
|
||||
return this.entry.fields.hasOwnProperty(field);
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue