Fix Bug #3522: OneDrive client create many file versions when file modified time differ (#3526)

* Fix issue where the client will create many file versions when file modified time differ locally to that online, and does not evaluate which timestamp should be corrected - online or local
* Add missing TOC entry in application-config-options.md
This commit is contained in:
abraunegg 2025-11-12 19:40:31 +11:00 committed by GitHub
commit b59c1dbc2d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 14 additions and 6 deletions

View file

@ -22,6 +22,7 @@ Before reading this document, please ensure you are running application version
- [disable_notifications](#disable_notifications)
- [disable_permission_set](#disable_permission_set)
- [disable_upload_validation](#disable_upload_validation)
- [disable_version_check](#disable_version_check)
- [disable_websocket_support](#disable_websocket_support)
- [display_manager_integration](#display_manager_integration)
- [display_running_config](#display_running_config)

View file

@ -5257,18 +5257,25 @@ class SyncEngine {
if (!appConfig.getValueBool("download_only")) {
// Not a --download-only scenario
if (!dryRun) {
// Attempt to update the online date time stamp
// Attempt to update the timestamp in the correct location
// We need to use the correct driveId and itemId, especially if we are updating a OneDrive Business Shared File timestamp
if (dbItem.type == ItemType.file) {
// Not a remote file
// Log what is being done
if (verboseLogging) {addLogEntry("The local item has the same hash value as the item online - correcting timestamp online", ["verbose"]);}
// Correct timestamp
uploadLastModifiedTime(dbItem, dbItem.driveId, dbItem.id, localModifiedTime.toUTC(), dbItem.eTag);
// Where should the timestamp update be performed ?
if (localModifiedTime >= itemModifiedTime) {
// Log what is being done
if (verboseLogging) {addLogEntry("The local item has the same hash value as the item online but with a newer local timestamp - correcting online timestamp", ["verbose"]);}
// Correct timestamp
uploadLastModifiedTime(dbItem, dbItem.driveId, dbItem.id, localModifiedTime.toUTC(), dbItem.eTag);
} else {
// Log what is being done
if (verboseLogging) {addLogEntry("The local item has the same hash value as the item online but with an older local timestamp - correcting local timestamp", ["verbose"]);}
// Set the timestamp, logging and error handling done within function
setLocalPathTimestamp(dryRun, localFilePath, dbItem.mtime);
}
} else {
// Remote file, remote values need to be used, we may not even have permission to change timestamp, update local file
if (verboseLogging) {addLogEntry("The local item has the same hash value as the item online, however file is a OneDrive Business Shared File - correcting local timestamp", ["verbose"]);}
// Set the timestamp, logging and error handling done within function
setLocalPathTimestamp(dryRun, localFilePath, dbItem.mtime);
}