1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-11-23 22:36:32 +02:00

Desktop, Cli, Mobile: Ensure that sync process ends up properly when Joplin Server shares cannot be accessed

This commit is contained in:
Laurent Cozic
2025-10-29 13:05:40 +01:00
parent 1fad9ca1cc
commit 42d8df3036

View File

@@ -457,30 +457,30 @@ export default class Synchronizer {
}
}
// Before synchronising make sure all share_id properties are set
// correctly so as to share/unshare the right items.
try {
await Folder.updateAllShareIds(this.resourceService(), this.shareService_ ? this.shareService_.shares : []);
if (this.shareService_) await this.shareService_.checkShareConsistency();
} catch (error) {
if (error && error.code === ErrorCode.IsReadOnly) {
// We ignore it because the functions above tried to modify a
// read-only item and failed. Normally it shouldn't happen since
// the UI should prevent, but if there's a bug in the UI or some
// other issue we don't want sync to fail because of this.
logger.error('Could not update share because an item is readonly:', error);
} else {
throw error;
}
}
const itemUploader = new ItemUploader(this.api(), this.apiCall);
let errorToThrow = null;
let syncLock = null;
let hasCaughtError = false;
try {
// Before synchronising make sure all share_id properties are set
// correctly so as to share/unshare the right items.
try {
await Folder.updateAllShareIds(this.resourceService(), this.shareService_ ? this.shareService_.shares : []);
if (this.shareService_) await this.shareService_.checkShareConsistency();
} catch (error) {
if (error && error.code === ErrorCode.IsReadOnly) {
// We ignore it because the functions above tried to modify a
// read-only item and failed. Normally it shouldn't happen since
// the UI should prevent, but if there's a bug in the UI or some
// other issue we don't want sync to fail because of this.
logger.error('Could not update share because an item is readonly:', error);
} else {
throw error;
}
}
const itemUploader = new ItemUploader(this.api(), this.apiCall);
await this.api().initialize();
this.api().setTempDirName(Dirnames.Temp);