mirror of
https://github.com/abraunegg/onedrive
synced 2024-06-29 10:50:30 +02:00
* Update logging output for better clarity * Update logging output from vdebug -> error for errors * Remove restrictive checks on fileDetails - if missing, continue, not return * Add debug lines for if / when this is missing
This commit is contained in:
parent
920ea5905c
commit
80675aa8b4
37
src/sync.d
37
src/sync.d
|
@ -328,6 +328,7 @@ final class SyncEngine
|
||||||
}
|
}
|
||||||
|
|
||||||
// Display accountType, defaultDriveId, defaultRootId & remainingFreeSpace for verbose logging purposes
|
// Display accountType, defaultDriveId, defaultRootId & remainingFreeSpace for verbose logging purposes
|
||||||
|
log.vlog("Application version: ", strip(import("version")));
|
||||||
log.vlog("Account Type: ", accountType);
|
log.vlog("Account Type: ", accountType);
|
||||||
log.vlog("Default Drive ID: ", defaultDriveId);
|
log.vlog("Default Drive ID: ", defaultDriveId);
|
||||||
log.vlog("Default Root ID: ", defaultRootId);
|
log.vlog("Default Root ID: ", defaultRootId);
|
||||||
|
@ -396,10 +397,13 @@ final class SyncEngine
|
||||||
string rootId = defaultRootId;
|
string rootId = defaultRootId;
|
||||||
applyDifferences(driveId, rootId);
|
applyDifferences(driveId, rootId);
|
||||||
|
|
||||||
// check all remote folders
|
// Check OneDrive Personal Shared Folders
|
||||||
// https://github.com/OneDrive/onedrive-api-docs/issues/764
|
// https://github.com/OneDrive/onedrive-api-docs/issues/764
|
||||||
Item[] items = itemdb.selectRemoteItems();
|
Item[] items = itemdb.selectRemoteItems();
|
||||||
foreach (item; items) applyDifferences(item.remoteDriveId, item.remoteId);
|
foreach (item; items) {
|
||||||
|
log.vlog("Syncing OneDrive Shared Folder: ", item.name);
|
||||||
|
applyDifferences(item.remoteDriveId, item.remoteId);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// download all new changes from a specified folder on OneDrive
|
// download all new changes from a specified folder on OneDrive
|
||||||
|
@ -1109,15 +1113,11 @@ final class SyncEngine
|
||||||
try {
|
try {
|
||||||
fileDetails = onedrive.getFileDetails(item.driveId, item.id);
|
fileDetails = onedrive.getFileDetails(item.driveId, item.id);
|
||||||
} catch (OneDriveException e) {
|
} catch (OneDriveException e) {
|
||||||
|
log.error("ERROR: Query of OneDrive for file details failed");
|
||||||
if (e.httpStatusCode >= 500) {
|
if (e.httpStatusCode >= 500) {
|
||||||
// OneDrive returned a 'HTTP 5xx Server Side Error' - gracefully handling error - error message already logged
|
// OneDrive returned a 'HTTP 5xx Server Side Error' - gracefully handling error - error message already logged
|
||||||
downloadFailed = true;
|
downloadFailed = true;
|
||||||
return;
|
return;
|
||||||
} else {
|
|
||||||
// Default operation if not a 500 error
|
|
||||||
log.error("ERROR: Query of OneDrive for file details failed");
|
|
||||||
downloadFailed = true;
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1132,7 +1132,7 @@ final class SyncEngine
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Issue #550 handling
|
// Issue #550 handling
|
||||||
log.vdebug("ERROR: onedrive.getFileDetails call returned a OneDriveException error");
|
log.error("ERROR: onedrive.getFileDetails call returned an invalid JSON Object");
|
||||||
// We want to return, cant download
|
// We want to return, cant download
|
||||||
downloadFailed = true;
|
downloadFailed = true;
|
||||||
return;
|
return;
|
||||||
|
@ -1141,17 +1141,22 @@ final class SyncEngine
|
||||||
if (!dryRun) {
|
if (!dryRun) {
|
||||||
ulong fileSize = 0;
|
ulong fileSize = 0;
|
||||||
string OneDriveFileHash;
|
string OneDriveFileHash;
|
||||||
if ( (hasFileSize(fileDetails)) && (hasQuickXorHash(fileDetails)) && (fileDetails.type() == JSONType.object) ) {
|
|
||||||
// fileDetails is a valid JSON object with the elements we need
|
// fileDetails should be a valid JSON due to prior check
|
||||||
// Set the file size from the returned data
|
if (hasFileSize(fileDetails)) {
|
||||||
|
// Use the configured filesize as reported by OneDrive
|
||||||
fileSize = fileDetails["size"].integer;
|
fileSize = fileDetails["size"].integer;
|
||||||
|
} else {
|
||||||
|
// filesize missing
|
||||||
|
log.vdebug("WARNING: fileDetails['size'] is missing");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (hasQuickXorHash(fileDetails)) {
|
||||||
|
// Use the configured quickXorHash as reported by OneDrive
|
||||||
OneDriveFileHash = fileDetails["file"]["hashes"]["quickXorHash"].str;
|
OneDriveFileHash = fileDetails["file"]["hashes"]["quickXorHash"].str;
|
||||||
} else {
|
} else {
|
||||||
// Issue #540 handling
|
// filesize missing
|
||||||
log.vdebug("ERROR: onedrive.getFileDetails call returned a OneDriveException error");
|
log.vdebug("WARNING: fileDetails['file']['hashes']['quickXorHash'] is missing");
|
||||||
// We want to return, cant download
|
|
||||||
downloadFailed = true;
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
Loading…
Reference in a new issue