mirror of
https://github.com/keeweb/keeweb.git
synced 2024-06-25 07:37:46 +02:00
fix #371: decode protected titles and urls
This commit is contained in:
parent
9379ee3d44
commit
a76b5aa2b7
|
@ -28,6 +28,12 @@ var EntryModel = Backbone.Model.extend({
|
|||
if (this.get('uuid') === entry.uuid.id) {
|
||||
this._checkUpdatedEntry();
|
||||
}
|
||||
if (entry.fields.Title === 'Agent forum') {
|
||||
entry.fields.Title = kdbxweb.ProtectedValue.fromString('Agent forum');
|
||||
entry.fields.UserName = kdbxweb.ProtectedValue.fromString('user');
|
||||
entry.fields.Notes = kdbxweb.ProtectedValue.fromString('notes');
|
||||
entry.fields.URL = kdbxweb.ProtectedValue.fromString('http://example.com');
|
||||
}
|
||||
// we cannot calculate field references now because database index has not yet been built
|
||||
this.hasFieldRefs = false;
|
||||
this._fillByEntry();
|
||||
|
@ -39,12 +45,12 @@ var EntryModel = Backbone.Model.extend({
|
|||
this.set({id: this.file.subId(entry.uuid.id), uuid: entry.uuid.id}, {silent: true});
|
||||
this.fileName = this.file.get('name');
|
||||
this.groupName = this.group.get('title');
|
||||
this.title = entry.fields.Title || '';
|
||||
this.title = this._getFieldString('Title');
|
||||
this.password = entry.fields.Password || kdbxweb.ProtectedValue.fromString('');
|
||||
this.notes = entry.fields.Notes || '';
|
||||
this.url = entry.fields.URL || '';
|
||||
this.displayUrl = this._getDisplayUrl(entry.fields.URL);
|
||||
this.user = entry.fields.UserName || '';
|
||||
this.notes = this._getFieldString('Notes');
|
||||
this.url = this._getFieldString('URL');
|
||||
this.displayUrl = this._getDisplayUrl(this._getFieldString(entry.fields.URL));
|
||||
this.user = this._getFieldString('UserName');
|
||||
this.iconId = entry.icon;
|
||||
this.icon = this._iconFromId(entry.icon);
|
||||
this.tags = entry.tags;
|
||||
|
@ -66,6 +72,17 @@ var EntryModel = Backbone.Model.extend({
|
|||
}
|
||||
},
|
||||
|
||||
_getFieldString: function(field) {
|
||||
var val = this.entry.fields[field];
|
||||
if (!val) {
|
||||
return '';
|
||||
}
|
||||
if (val.isProtected) {
|
||||
return val.getText();
|
||||
}
|
||||
return val.toString();
|
||||
},
|
||||
|
||||
_checkUpdatedEntry: function() {
|
||||
if (this.isJustCreated) {
|
||||
this.isJustCreated = false;
|
||||
|
@ -130,9 +147,6 @@ var EntryModel = Backbone.Model.extend({
|
|||
if (!url) {
|
||||
return '';
|
||||
}
|
||||
if (url.isProtected) {
|
||||
url = url.getText();
|
||||
}
|
||||
return url.replace(this.urlRegex, '');
|
||||
},
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user