diff --git a/README.md b/README.md index 7928519b..3255a28c 100644 --- a/README.md +++ b/README.md @@ -133,7 +133,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 diff --git a/src/sync.d b/src/sync.d index 17d1199e..7e0a59ce 100644 --- a/src/sync.d +++ b/src/sync.d @@ -154,6 +154,7 @@ 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; @@ -172,7 +173,8 @@ final class SyncEngine } } foreach (item; changes["value"].array) { - applyDifference(item, driveId); + bool isRoot = (id == item["id"].str); // fix for https://github.com/skilion/onedrive/issues/269 + applyDifference(item, driveId, isRoot); } // the response may contain either @odata.deltaLink or @odata.nextLink @@ -189,13 +191,14 @@ 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.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;