Fixed fingerprint and mkdir bugs

This commit is contained in:
Alex Shpak 2017-04-25 22:52:07 +02:00
parent bd9144628f
commit 14b953f764
2 changed files with 10 additions and 7 deletions

View File

@ -48,7 +48,10 @@ const Launcher = {
}, callback);
};
window.resolveLocalFileSystemURL(path, writeFile, callback, callback);
const filePath = this.parsePath(path);
window.resolveLocalFileSystemURL(filePath.dir, dir => {
dir.getFile(filePath.file, {create: true}, writeFile);
}, callback, callback);
},
readFile: function(path, encoding, callback) {
window.resolveLocalFileSystemURL(path, fileEntry => {
@ -109,8 +112,8 @@ const Launcher = {
return {
path: fileName,
dir: parts.pop(),
file: parts.join('/')
file: parts.pop(),
dir: parts.join('/')
};
},
createFsWatcher: function(path) {
@ -184,7 +187,7 @@ const Launcher = {
const encryptConfig = _.extend({}, this.config, {
username: fileId,
password: password
password: password.getText()
});
FingerprintAuth.encrypt(encryptConfig, result => {

View File

@ -1021,12 +1021,12 @@ const AppModel = Backbone.Model.extend({
},
saveFileFingerprint: function(file, password) {
if (Launcher && Launcher.fingerprints && password) {
if (Launcher && Launcher.fingerprints && !file.has('fingerprint')) {
const fileInfo = this.fileInfos.get(file.id);
Launcher.fingerprints.register(file.id, this.params.password, token => {
Launcher.fingerprints.register(file.id, password, token => {
if (token) {
fileInfo.set('fingerprint', token);
this.model.fileInfos.save();
this.fileInfos.save();
}
});
}