mirror of https://github.com/keeweb/keeweb
fixed an error when files were closed during sync
parent
b41b291e60
commit
7394754b6f
|
@ -833,6 +833,9 @@ class AppModel {
|
|||
if (file.syncing) {
|
||||
return callback && callback('Sync in progress');
|
||||
}
|
||||
if (!file.active) {
|
||||
return callback && callback('File is closed');
|
||||
}
|
||||
if (!options) {
|
||||
options = {};
|
||||
}
|
||||
|
@ -872,6 +875,9 @@ class AppModel {
|
|||
if (!err) {
|
||||
savedToCache = true;
|
||||
}
|
||||
if (!file.active) {
|
||||
return callback && callback('File is closed');
|
||||
}
|
||||
logger.info('Sync finished', err || 'no error');
|
||||
file.setSyncComplete(path, storage, err ? err.toString() : null, savedToCache);
|
||||
fileInfo.set({
|
||||
|
@ -925,6 +931,9 @@ class AppModel {
|
|||
logger.info('Load from storage, attempt ' + loadLoops);
|
||||
Storage[storage].load(path, opts, (err, data, stat) => {
|
||||
logger.info('Load from storage', stat, err || 'no error');
|
||||
if (!file.active) {
|
||||
return complete('File is closed');
|
||||
}
|
||||
if (err) {
|
||||
return complete(err);
|
||||
}
|
||||
|
@ -1024,6 +1033,9 @@ class AppModel {
|
|||
};
|
||||
logger.info('Stat file');
|
||||
Storage[storage].stat(path, opts, (err, stat) => {
|
||||
if (!file.active) {
|
||||
return complete('File is closed');
|
||||
}
|
||||
if (err) {
|
||||
if (err.notFound) {
|
||||
logger.info('File does not exist in storage, creating');
|
||||
|
|
Loading…
Reference in New Issue