Skip to content

Commit 43ba76c

Browse files
committed
Update sync.d
* Update PR based on further Shared Folder lowercase in JSON response needing remediation
1 parent 5d836ad commit 43ba76c

File tree

1 file changed

+47
-3
lines changed

1 file changed

+47
-3
lines changed

src/sync.d

+47-3
Original file line numberDiff line numberDiff line change
@@ -3196,7 +3196,20 @@ class SyncEngine {
31963196

31973197
// Is the last modified timestamp in the DB the same as the API data or are we running an operational mode where we simulated the /delta response?
31983198
if ((existingItemModifiedTime != changedOneDriveItemModifiedTime) || (generateSimulatedDeltaResponse)) {
3199-
// Save this item in the database
3199+
// Save this item in the database
3200+
3201+
// Issue #3115 - Personal Account Shared Folder
3202+
// What account type is this?
3203+
if (appConfig.accountType == "personal") {
3204+
// Is this a 'remote' DB record
3205+
if (changedOneDriveItem.type == ItemType.remote) {
3206+
// Fetch the actual online record for this item
3207+
// This returns the actual OneDrive Personal driveId value and is 15 character checked
3208+
string actualOnlineDriveId = fetchRealOnlineDriveIdentifier(changedOneDriveItem.remoteDriveId);
3209+
changedOneDriveItem.remoteDriveId = actualOnlineDriveId;
3210+
}
3211+
}
3212+
32003213
// Add to the local database
32013214
if (debugLogging) {addLogEntry("Adding changed OneDrive Item to database: " ~ to!string(changedOneDriveItem), ["debug"]);}
32023215
itemDB.upsert(changedOneDriveItem);
@@ -3231,6 +3244,19 @@ class SyncEngine {
32313244
// Is the last modified timestamp in the DB the same as the API data or are we running an operational mode where we simulated the /delta response?
32323245
if ((existingItemModifiedTime != changedOneDriveItemModifiedTime) || (generateSimulatedDeltaResponse)) {
32333246
// Database update needed for this item because our local record is out-of-date
3247+
3248+
// Issue #3115 - Personal Account Shared Folder
3249+
// What account type is this?
3250+
if (appConfig.accountType == "personal") {
3251+
// Is this a 'remote' DB record
3252+
if (changedOneDriveItem.type == ItemType.remote) {
3253+
// Fetch the actual online record for this item
3254+
// This returns the actual OneDrive Personal driveId value and is 15 character checked
3255+
string actualOnlineDriveId = fetchRealOnlineDriveIdentifier(changedOneDriveItem.remoteDriveId);
3256+
changedOneDriveItem.remoteDriveId = actualOnlineDriveId;
3257+
}
3258+
}
3259+
32343260
// Add to the local database
32353261
if (debugLogging) {addLogEntry("Adding changed OneDrive Item to database: " ~ to!string(changedOneDriveItem), ["debug"]);}
32363262
itemDB.upsert(changedOneDriveItem);
@@ -4090,7 +4116,10 @@ class SyncEngine {
40904116
}
40914117

40924118
// What driveID and itemID we trying to calculate the path for
4093-
if (debugLogging) {addLogEntry("Attempting to calculate initial local filesystem path for " ~ thisDriveId ~ " and " ~ thisItemId, ["debug"]);}
4119+
if (debugLogging) {
4120+
string initialComputeLogMessage = format("Attempting to calculate initial local filesystem path for '%s' and '%s'", thisDriveId, thisItemId);
4121+
addLogEntry(initialComputeLogMessage, ["debug"]);
4122+
}
40944123

40954124
// Perform the original calculation of the path using the values provided
40964125
try {
@@ -4119,7 +4148,7 @@ class SyncEngine {
41194148
string fullLocalPath;
41204149
string localPathExtension;
41214150

4122-
if (debugLogging) {addLogEntry("Attempting to calculate shared folder local filesystem path for " ~ thisDriveId ~ " and " ~ thisItemId, ["debug"]);}
4151+
if (debugLogging) {addLogEntry("Attempting to calculate Shared Folder local filesystem path for " ~ thisDriveId ~ " and " ~ thisItemId, ["debug"]);}
41234152

41244153
// Get the DB entry for this 'remote' item
41254154
itemDB.selectRemoteTypeByRemoteDriveId(thisDriveId, thisItemId, remoteEntryItem);
@@ -9234,6 +9263,12 @@ class SyncEngine {
92349263
logKey = generateAlphanumericString();
92359264
displayFunctionProcessingStart(thisFunctionName, logKey);
92369265
}
9266+
9267+
// What are we doing
9268+
if (debugLogging) {
9269+
string fetchRealValueLogMessage = format("Fetching actual online 'driveId' value for '%s'", inputDriveId);
9270+
addLogEntry(fetchRealValueLogMessage, ["debug"]);
9271+
}
92379272

92389273
// variables for this function
92399274
JSONValue remoteDriveDetails;
@@ -9387,6 +9422,15 @@ class SyncEngine {
93879422
searchItem.driveId = pathData["remoteItem"]["parentReference"]["driveId"].str;
93889423
searchItem.id = pathData["remoteItem"]["id"].str;
93899424
remotePathObject = true;
9425+
9426+
// Issue #3115 - Personal Account Shared Folder
9427+
// What account type is this?
9428+
if (appConfig.accountType == "personal") {
9429+
// Fetch the actual online record for this item
9430+
// This returns the actual OneDrive Personal driveId value and is 15 character checked
9431+
string actualOnlineDriveId = fetchRealOnlineDriveIdentifier(searchItem.driveId);
9432+
searchItem.driveId = actualOnlineDriveId;
9433+
}
93909434
}
93919435
} catch (OneDriveException exception) {
93929436
// Display error message

0 commit comments

Comments
 (0)