mirror of
https://github.com/abraunegg/onedrive
synced 2026-03-14 14:35:46 +01:00
fix addressing root by path
This commit is contained in:
parent
a3b25c45f5
commit
1260fcfcc1
2 changed files with 7 additions and 5 deletions
|
|
@ -115,9 +115,9 @@ final class OneDriveApi
|
|||
JSONValue viewChangesByPath(const(char)[] path, const(char)[] statusToken)
|
||||
{
|
||||
checkAccessTokenExpired();
|
||||
//string url = itemByPathUrl ~ encodeComponent(path) ~ ":/delta";
|
||||
// HACK: item by path seems to no be working
|
||||
string url = "https://graph.microsoft.com/v1.0/me/drive/root/delta";
|
||||
string url = itemByPathUrl ~ encodeComponent(path) ~ ":/delta";
|
||||
// HACK
|
||||
if (path == ".") url = driveUrl ~ "/root/delta";
|
||||
url ~= "?select=id,name,eTag,cTag,deleted,file,folder,fileSystemInfo,remoteItem,parentReference";
|
||||
if (statusToken) url ~= "&token=" ~ statusToken;
|
||||
return get(url);
|
||||
|
|
@ -170,6 +170,8 @@ final class OneDriveApi
|
|||
{
|
||||
checkAccessTokenExpired();
|
||||
string url = itemByPathUrl ~ encodeComponent(parentPath) ~ ":/children";
|
||||
// HACK
|
||||
if (parentPath == ".") url = driveUrl ~ "/root/children";
|
||||
http.addRequestHeader("Content-Type", "application/json");
|
||||
return post(url, item.toString());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -95,7 +95,7 @@ final class SyncEngine
|
|||
do {
|
||||
// get changes from the server
|
||||
try {
|
||||
changes = onedrive.viewChangesByPath("/", statusToken);
|
||||
changes = onedrive.viewChangesByPath(".", statusToken);
|
||||
} catch (OneDriveException e) {
|
||||
if (e.httpStatusCode == 410) {
|
||||
log.log("Status token expired, resyncing");
|
||||
|
|
@ -474,7 +474,7 @@ final class SyncEngine
|
|||
log.log("Creating remote directory: ", path);
|
||||
JSONValue item = ["name": baseName(path).idup];
|
||||
item["folder"] = parseJSON("{}");
|
||||
auto res = onedrive.createByPath(path.dirName ~ "/", item);
|
||||
auto res = onedrive.createByPath(path.dirName, item);
|
||||
saveItem(res);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue