hack for onedrive biz

This commit is contained in:
skilion 2017-06-15 14:19:23 +02:00
parent 3529a4f78b
commit 126f2719b8

View file

@ -36,6 +36,9 @@ private bool isItemRemote(const ref JSONValue item)
return ("remoteItem" in item) != null; return ("remoteItem" in item) != null;
} }
// HACK: OneDrive Biz does not return parentReference for the root
string defaultDriveId;
private Item makeItem(const ref JSONValue jsonItem) private Item makeItem(const ref JSONValue jsonItem)
{ {
ItemType type; ItemType type;
@ -48,7 +51,7 @@ private Item makeItem(const ref JSONValue jsonItem)
} }
Item item = { Item item = {
driveId: jsonItem["parentReference"]["driveId"].str, driveId: isItemRoot(jsonItem) ? defaultDriveId : jsonItem["parentReference"]["driveId"].str,
id: jsonItem["id"].str, id: jsonItem["id"].str,
name: jsonItem["name"].str, name: jsonItem["name"].str,
type: type, type: type,
@ -147,6 +150,7 @@ final class SyncEngine
} }
try { try {
defaultDriveId = onedrive.getDefaultDrive()["id"].str;
JSONValue changes; JSONValue changes;
do { do {
// get changes from the server // get changes from the server