You've already forked joplin
mirror of
https://github.com/laurent22/joplin.git
synced 2025-11-23 22:36:32 +02:00
All: Allow modifying a resource metadata only when synchronising (#9114)
This commit is contained in:
@@ -604,7 +604,7 @@ export default class Synchronizer {
|
||||
} else {
|
||||
// Note: in order to know the real updated_time value, we need to load the content. In theory we could
|
||||
// rely on the file timestamp (in remote.updated_time) but in practice it's not accurate enough and
|
||||
// can lead to conflicts (for example when the file timestamp is slightly ahead of it's real
|
||||
// can lead to conflicts (for example when the file timestamp is slightly ahead of its real
|
||||
// updated_time). updated_time is set and managed by clients so it's always accurate.
|
||||
// Same situation below for updateLocal.
|
||||
//
|
||||
@@ -701,7 +701,15 @@ export default class Synchronizer {
|
||||
logger.warn(`Uploading a large resource (resourceId: ${local.id}, size:${resource.size} bytes) which may tie up the sync process.`);
|
||||
}
|
||||
|
||||
await this.apiCall('put', remoteContentPath, null, { path: localResourceContentPath, source: 'file', shareId: resource.share_id });
|
||||
// We skip updating the blob if it hasn't
|
||||
// been modified since the last sync. In
|
||||
// that case, it means the resource metadata
|
||||
// (title, filename, etc.) has been changed,
|
||||
// but not the data blob.
|
||||
const syncItem = await BaseItem.syncItem(syncTargetId, resource.id, { fields: ['sync_time', 'force_sync'] });
|
||||
if (!syncItem || syncItem.sync_time < resource.blob_updated_time || syncItem.force_sync) {
|
||||
await this.apiCall('put', remoteContentPath, null, { path: localResourceContentPath, source: 'file', shareId: resource.share_id });
|
||||
}
|
||||
} catch (error) {
|
||||
if (isCannotSyncError(error)) {
|
||||
await handleCannotSyncItem(ItemClass, syncTargetId, local, error.message);
|
||||
|
||||
Reference in New Issue
Block a user