From b7e61c93e8b612439f20180c36f09776e2310bf3 Mon Sep 17 00:00:00 2001 From: abraunegg Date: Sun, 27 Apr 2025 07:40:51 +1000 Subject: [PATCH] Fix Bug #3237: Fix handling of POSIX check for existing online items (#3238) * Enhance POSIX compliance test by performing a toLower conversion to ensure strings being tested are exactly the same * Add debug logging line when lowercase match of input values occur * If a 'file' is found at that location, debug output the contents earlier for easier logfile analysis --- src/sync.d | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/src/sync.d b/src/sync.d index 687fa0c3..14f84135 100644 --- a/src/sync.d +++ b/src/sync.d @@ -8058,11 +8058,15 @@ class SyncEngine { // Note that NTFS supports POSIX semantics for case sensitivity but this is not the default behavior. bool posixIssue = false; - // Is the name different + // Check for a POSIX casing mismatch if (localNameToCheck != onlineName) { - // POSIX Error - // Local item name has a 'case-insensitive match' to an existing item on OneDrive - posixIssue = true; + // The input items are different .. how are they different? + if (toLower(localNameToCheck) == toLower(onlineName)) { + // Names differ only by case -> POSIX issue + if (debugLogging) {addLogEntry("performPosixTest: Names differ only by case -> POSIX issue", ["debug"]);} + // Local item name has a 'case-insensitive match' to an existing item on OneDrive + posixIssue = true; + } } // Display function processing time if configured to do so @@ -8358,6 +8362,9 @@ class SyncEngine { // Perform Garbage Collection GC.collect(); + // No 404 which means a file was found with the path we are trying to upload to + if (debugLogging) {addLogEntry("fileDetailsFromOneDrive JSON data after exist online check: " ~ to!string(fileDetailsFromOneDrive), ["debug"]);} + // Portable Operating System Interface (POSIX) testing of JSON response from OneDrive API if (hasName(fileDetailsFromOneDrive)) { // Perform the POSIX evaluation test against the names @@ -8372,9 +8379,6 @@ class SyncEngine { // and that it matches the POSIX filename of the local item we are trying to upload as a new file if (verboseLogging) {addLogEntry("The file we are attempting to upload as a new file already exists on Microsoft OneDrive: " ~ fileToUpload, ["verbose"]);} - // No 404 or otherwise was triggered, meaning that the file already exists online and passes the POSIX test ... - if (debugLogging) {addLogEntry("fileDetailsFromOneDrive after exist online check: " ~ to!string(fileDetailsFromOneDrive), ["debug"]);} - // Does the data from online match our local file that we are attempting to upload as a new file? if (!disableUploadValidation && performUploadIntegrityValidationChecks(fileDetailsFromOneDrive, fileToUpload, thisFileSize)) { // Save online item details to the database