fix #119: open files created without password

This commit is contained in:
Antelle 2016-02-26 23:45:54 +03:00
parent 4e1b5b58b1
commit 2de1515205
3 changed files with 7 additions and 2 deletions

View File

@ -334,7 +334,7 @@ var AppModel = Backbone.Model.extend({
openFileWithData: function(params, callback, fileInfo, data, updateCacheOnSuccess) {
var logger = new Logger('open', params.name);
if (!params.keyFileName && fileInfo.get('keyFileName') && this.settings.get('rememberKeyFiles')) {
if (!params.keyFileName && fileInfo && fileInfo.get('keyFileName') && this.settings.get('rememberKeyFiles')) {
params.keyFileName = fileInfo.get('keyFileName');
params.keyFileData = FileModel.createKeyFileWithHash(fileInfo.get('keyFileHash'));
}

View File

@ -49,12 +49,16 @@ var FileModel = Backbone.Model.extend({
var ts = logger.ts();
kdbxweb.Kdbx.load(fileData, credentials, (function(db, err) {
if (err) {
if (err.code === kdbxweb.Consts.ErrorCodes.InvalidKey && password && !password.byteLength) {
logger.info('Error opening file with empty password, try to open with null password');
return this.open(null, fileData, keyFileData, callback);
}
logger.error('Error opening file', err.code, err.message, err);
callback(err);
} else {
this.db = db;
this.readModel();
this.setOpenFile({ passwordLength: password.textLength });
this.setOpenFile({ passwordLength: password ? password.textLength : 0 });
if (keyFileData) {
kdbxweb.ByteUtils.zeroBuffer(keyFileData);
}

View File

@ -10,6 +10,7 @@ Storage providers, usability improvements
`+` password generation presets
`+` regenerate password button
`+` option to search in title
`+` open files created without password
`-` fix #88: capslock indicator
##### v1.0.4 (2016-02-25)