From bb3121e10d3ef45e0df1010898aecbef04d3ae11 Mon Sep 17 00:00:00 2001 From: skilion Date: Sat, 6 Jan 2018 17:50:36 +0100 Subject: [PATCH 1/4] fix for https://github.com/skilion/onedrive/issues/269 --- src/sync.d | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/sync.d b/src/sync.d index 17d1199e..dd8609ae 100644 --- a/src/sync.d +++ b/src/sync.d @@ -154,10 +154,12 @@ final class SyncEngine // download the new changes of a specific item + // id is the root of the drive or a shared folder private void applyDifferences(string driveId, const(char)[] id) { JSONValue changes; string deltaLink = itemdb.getDeltaLink(driveId, id); + bool isRoot = true; // fix for https://github.com/skilion/onedrive/issues/269 log.vlog("Applying changes of " ~ id); do { try { @@ -172,7 +174,8 @@ final class SyncEngine } } foreach (item; changes["value"].array) { - applyDifference(item, driveId); + applyDifference(item, driveId, isRoot); + isRoot = false; } // the response may contain either @odata.deltaLink or @odata.nextLink @@ -189,12 +192,12 @@ final class SyncEngine } // process the change of a single DriveItem - private void applyDifference(JSONValue driveItem, string driveId) + private void applyDifference(JSONValue driveItem, string driveId, bool isRoot) { Item item = makeItem(driveItem); log.vlog("Processing ", item.id, " ", item.name); - if (isItemRoot(driveItem) || !item.parentId) { + if (isItemRoot(driveItem) || !item.parentId || isRoot) { log.vlog("Root"); item.driveId = driveId; // HACK: makeItem() cannot set the driveId propery of the root itemdb.upsert(item); From d624aec3ad530837186fc3dca25b6b2fad1363c8 Mon Sep 17 00:00:00 2001 From: skilion Date: Sat, 6 Jan 2018 18:01:07 +0100 Subject: [PATCH 2/4] added examples of relevant info for reporting issues --- README.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index a19006c3..c64e7866 100644 --- a/README.md +++ b/README.md @@ -132,7 +132,10 @@ If you encounter any bugs you can report them here on Github. Before filing an i 1. Check the version of the application you are using `onedrive --version` 2. Run the application in verbose mode `onedrive --verbose` 3. Have the log of the error (preferably uploaded on an external website such as [pastebin](https://pastebin.com/)) -4. Collect any information that you may think it is relevant to the error (such as the steps to trigger it) +4. Collect any information that you may think it is relevant to the error + - The steps to trigger the error + - What have you already done to try solve it + - ... ### All available commands: ```text From abad626b3d2347970c5288408760783364cef55a Mon Sep 17 00:00:00 2001 From: skilion Date: Sat, 6 Jan 2018 19:27:27 +0100 Subject: [PATCH 3/4] ensures that the parentId of the root is null --- src/sync.d | 1 + 1 file changed, 1 insertion(+) diff --git a/src/sync.d b/src/sync.d index dd8609ae..868548da 100644 --- a/src/sync.d +++ b/src/sync.d @@ -199,6 +199,7 @@ final class SyncEngine if (isItemRoot(driveItem) || !item.parentId || isRoot) { log.vlog("Root"); + item.parentId = null; // ensures that it has no parent item.driveId = driveId; // HACK: makeItem() cannot set the driveId propery of the root itemdb.upsert(item); return; From c7e09304a6e5777702bb928e2cdb76f2cead87d7 Mon Sep 17 00:00:00 2001 From: skilion Date: Sat, 6 Jan 2018 21:59:05 +0100 Subject: [PATCH 4/4] fix for https://github.com/skilion/onedrive/issues/269 --- src/sync.d | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/sync.d b/src/sync.d index 868548da..7e0a59ce 100644 --- a/src/sync.d +++ b/src/sync.d @@ -159,7 +159,6 @@ final class SyncEngine { JSONValue changes; string deltaLink = itemdb.getDeltaLink(driveId, id); - bool isRoot = true; // fix for https://github.com/skilion/onedrive/issues/269 log.vlog("Applying changes of " ~ id); do { try { @@ -174,8 +173,8 @@ final class SyncEngine } } foreach (item; changes["value"].array) { + bool isRoot = (id == item["id"].str); // fix for https://github.com/skilion/onedrive/issues/269 applyDifference(item, driveId, isRoot); - isRoot = false; } // the response may contain either @odata.deltaLink or @odata.nextLink