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
This commit is contained in:
abraunegg 2025-04-27 07:40:51 +10:00 committed by GitHub
commit b7e61c93e8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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