From a2d1a7cd494266bc72d71ce546de8011013a01c2 Mon Sep 17 00:00:00 2001 From: Daniel Date: Sat, 18 Oct 2025 21:28:09 +0200 Subject: [PATCH] Fix Bug #3479: Fix missing user information when syncing shared files (#3483) * fix: database inconsistency due to unassigned variable * fix: more debug logging, setting sharedByFolderName to Email as fallback --------- Co-authored-by: Daniel Schiffner Co-authored-by: abraunegg --- src/sync.d | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/sync.d b/src/sync.d index e840e706..f69f8272 100644 --- a/src/sync.d +++ b/src/sync.d @@ -14191,13 +14191,18 @@ class SyncEngine { sharedByFolderName = sharedByName ~ " (" ~ sharedByEmail ~ ")"; } else { + if (debugLogging) {addLogEntry("Either name or email is not defined -> check specifically. Currently: " ~ to!string(sharedByName) ~ " / " ~ to!string(sharedByEmail), ["debug"]);} if (sharedByName != "") { sharedByFolderName = sharedByName; + } else { + sharedByFolderName = sharedByEmail; } } + if (debugLogging) {addLogEntry("Combined folder set to " ~ to!string(sharedByFolderName), ["debug"]);} // Create the local path to store this users shared files with us newLocalSharedFilePath = buildNormalizedPath(buildPath(appConfig.configuredBusinessSharedFilesDirectoryName, sharedByFolderName)); + if (debugLogging) {addLogEntry("newLocalSharedFilePath is located at " ~ to!string(newLocalSharedFilePath), ["debug"]);} // Does the Shared File Users Local Directory to store the shared file(s) exist? if (!exists(newLocalSharedFilePath)) { @@ -14230,6 +14235,10 @@ class SyncEngine { // Add DB record to the local database if (debugLogging) {addLogEntry("Creating|Updating into local database a DB record for storing OneDrive Business Shared Files: " ~ to!string(sharedFilesPath), ["debug"]);} itemDB.upsert(sharedFilesPath); + } else { + // If the folder exists in the db, assign the variable to have the parentID available + sharedFilesPath = dbRecord; + if (debugLogging) {addLogEntry("Recreating local database record for storing OneDrive Business Shared Files: " ~ to!string(sharedFilesPath), ["debug"]);} } }