From 2529b99265c962ec87ddd9648545be689fb03336 Mon Sep 17 00:00:00 2001 From: abraunegg Date: Sun, 10 May 2020 05:42:46 +1000 Subject: [PATCH] Update enforce statement for parent id database query (Issue #912) (#913) * Update database enforce check with conditional check on parent drive ID. If the parent is a shared folder, the parent ID will never be in the database as we are never provided that parent ID. --- src/sync.d | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/sync.d b/src/sync.d index 6eec4afa..ef77894b 100644 --- a/src/sync.d +++ b/src/sync.d @@ -2990,11 +2990,17 @@ final class SyncEngine // Perform the database lookup - is the parent in the database? if (!itemdb.selectByPath(dirName(path), parent.driveId, parent)) { // parent is not in the database - log.vdebug("Parent path is not in the database - need to add it"); + log.vdebug("Parent path is not in the database - need to add it: ", dirName(path)); uploadCreateDir(dirName(path)); } - // still enforce check of parent path. if the above was triggered, the below will generate a sync retry and will now be sucessful - enforce(itemdb.selectByPath(dirName(path), parent.driveId, parent), "The parent item id is not in the database"); + + // Is the parent a 'folder' from another user? ie - is this a 'shared folder' that has been shared with us? + if (defaultDriveId == parent.driveId){ + // enforce check of parent path. if the above was triggered, the below will generate a sync retry and will now be sucessful + enforce(itemdb.selectByPath(dirName(path), parent.driveId, parent), "The parent item id is not in the database"); + } else { + log.vdebug("Parent drive ID is not our drive ID - parent most likely a shared folder"); + } JSONValue driveItem = [ "name": JSONValue(baseName(path)),