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.
This commit is contained in:
abraunegg 2019-10-26 14:17:40 +11:00 committed by GitHub
parent 585b35724f
commit e99872eaa2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

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