fix path handling of direct children of the root

This commit is contained in:
skilion 2017-12-29 16:51:08 +01:00
parent dd3e1b2861
commit b250214577

View file

@ -1,4 +1,5 @@
import std.algorithm;
import std.array: array;
import std.net.curl: CurlTimeoutException;
import std.exception: ErrnoException;
import std.datetime, std.file, std.json, std.path;
@ -50,7 +51,7 @@ private Item makeItem(const ref JSONValue jsonItem)
}
Item item = {
driveId: defaultDriveId, // HACK
driveId: "parentReference" in jsonItem ? jsonItem["parentReference"]["driveId"].str : defaultDriveId, // HACK
id: jsonItem["id"].str,
name: "name" in jsonItem ? jsonItem["name"].str : null, // name may be missing for deleted files in OneDrive Biz
type: type,
@ -218,6 +219,8 @@ final class SyncEngine
if (!unwanted && !isItemRoot(jsonItem)) {
// delay path computation after assuring the item parent is not excluded
path = itemdb.computePath(item.parentDriveId, item.parentId) ~ "/" ~ item.name;
// ensure path matches the path generated by itemdb.computePath()
path = asNormalizedPath(path).array;
// selective sync
unwanted |= selectiveSync.isPathExcluded(path);
}
@ -347,6 +350,8 @@ final class SyncEngine
// nothing to do
break;
}
} else {
log.vlog("The item content has not changed");
}
// handle changed time
if (newItem.type == ItemType.file) {