From e99872eaa28ceb7ac52f033634bf782b893b0a4f Mon Sep 17 00:00:00 2001 From: abraunegg Date: Sat, 26 Oct 2019 14:17:40 +1100 Subject: [PATCH] Fix 'Key not found: name' when computing skip_dir path (#701) * OneDrive API difference between Personal & Business where some Business accounts do not send 'name' key with parent reference. Check for existance of 'name' key before use. --- src/sync.d | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/sync.d b/src/sync.d index a1b60892..746d0a46 100644 --- a/src/sync.d +++ b/src/sync.d @@ -1117,7 +1117,13 @@ final class SyncEngine // we need to workout the FULL path for this item string parentDriveId = driveItem["parentReference"]["driveId"].str; string parentItem = driveItem["parentReference"]["id"].str; - simplePathToCheck = driveItem["parentReference"]["name"].str ~ "/" ~ driveItem["name"].str; + // simple path + if (("name" in driveItem["parentReference"]) != null) { + simplePathToCheck = driveItem["parentReference"]["name"].str ~ "/" ~ driveItem["name"].str; + } else { + simplePathToCheck = driveItem["name"].str; + } + // complex path complexPathToCheck = itemdb.computePath(parentDriveId, parentItem) ~ "/" ~ driveItem["name"].str; complexPathToCheck = buildNormalizedPath(complexPathToCheck); log.vdebug("skip_dir path to check (simple): ", simplePathToCheck);