mirror of https://github.com/keeweb/keeweb.git
fix dropbox sync init errors
This commit is contained in:
parent
2d9f27f852
commit
6920cfeb39
|
@ -160,34 +160,42 @@ var SettingsAboutView = Backbone.View.extend({
|
|||
var fileName = that.model.get('name') + '.kdbx';
|
||||
that.model.set('syncing', true);
|
||||
that.render();
|
||||
DropboxLink.saveFile(fileName, data, overwrite, function (err) {
|
||||
DropboxLink.authenticate(function(err) {
|
||||
if (err) {
|
||||
that.model.set('syncing', false);
|
||||
if (err.exists) {
|
||||
Alerts.alert({
|
||||
header: 'Already exists',
|
||||
body: 'File ' + fileName + ' already exists in your Dropbox.',
|
||||
icon: 'question',
|
||||
buttons: [{result: 'yes', title: 'Overwrite it'}, {result: '', title: 'I\'ll choose another name'}],
|
||||
esc: '',
|
||||
click: '',
|
||||
enter: 'yes',
|
||||
success: that.saveToDropbox.bind(that, true),
|
||||
cancel: function () {
|
||||
that.$el.find('#settings__file-name').focus();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
Alerts.error({
|
||||
header: 'Save error',
|
||||
body: 'Error saving to Dropbox: \n' + err
|
||||
});
|
||||
}
|
||||
} else {
|
||||
that.passwordChanged = false;
|
||||
that.model.saved(fileName, 'dropbox');
|
||||
that.render();
|
||||
return;
|
||||
}
|
||||
DropboxLink.saveFile(fileName, data, overwrite, function (err) {
|
||||
if (err) {
|
||||
that.model.set('syncing', false);
|
||||
that.render();
|
||||
if (err.exists) {
|
||||
Alerts.alert({
|
||||
header: 'Already exists',
|
||||
body: 'File ' + fileName + ' already exists in your Dropbox.',
|
||||
icon: 'question',
|
||||
buttons: [{result: 'yes', title: 'Overwrite it'}, {result: '', title: 'I\'ll choose another name'}],
|
||||
esc: '',
|
||||
click: '',
|
||||
enter: 'yes',
|
||||
success: that.saveToDropbox.bind(that, true),
|
||||
cancel: function () {
|
||||
that.$el.find('#settings__file-name').focus();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
Alerts.error({
|
||||
header: 'Save error',
|
||||
body: 'Error saving to Dropbox: \n' + err
|
||||
});
|
||||
}
|
||||
} else {
|
||||
that.passwordChanged = false;
|
||||
that.model.saved(fileName, 'dropbox');
|
||||
that.render();
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue