From 3529a4f78b5a8cfdbd4f05c51034eb5a4a595cfe Mon Sep 17 00:00:00 2001 From: skilion Date: Thu, 15 Jun 2017 13:45:14 +0200 Subject: [PATCH] make makeItem() more resiliant --- src/sync.d | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/sync.d b/src/sync.d index f7c883f4..1f2b068d 100644 --- a/src/sync.d +++ b/src/sync.d @@ -54,7 +54,7 @@ private Item makeItem(const ref JSONValue jsonItem) type: type, eTag: isItemRoot(jsonItem) ? null : jsonItem["eTag"].str, // eTag is not returned for the root in OneDrive Biz cTag: "cTag" !in jsonItem ? null : jsonItem["cTag"].str, // cTag is missing in old files (plus all folders) - mtime: isItemRemote(jsonItem) ? SysTime(0) : SysTime.fromISOExtString(jsonItem["fileSystemInfo"]["lastModifiedDateTime"].str), + mtime: "fileSystemInfo" in jsonItem ? SysTime.fromISOExtString(jsonItem["fileSystemInfo"]["lastModifiedDateTime"].str) : SysTime(0), parentDriveId: isItemRoot(jsonItem) ? null : jsonItem["parentReference"]["driveId"].str, parentId: isItemRoot(jsonItem) ? null : jsonItem["parentReference"]["id"].str }; @@ -71,9 +71,6 @@ private Item makeItem(const ref JSONValue jsonItem) } else { log.vlog("The file does not have any hash"); } - } else { - // 'hashes' is missing in old files - log.vlog("No hashes facet"); } } @@ -148,7 +145,7 @@ final class SyncEngine } catch (FileException e) { // swallow exception } - + try { JSONValue changes; do { @@ -189,8 +186,8 @@ final class SyncEngine private void applyDifference(JSONValue jsonItem) { + log.vlog(jsonItem["id"].str, " ", jsonItem["name"].str); Item item = makeItem(jsonItem); - log.vlog(item.id, " ", item.name); string path = "."; bool unwanted;