Update issue #540 fix (#543)

* Update how and when filesize is configured and used before file download
This commit is contained in:
abraunegg 2019-06-18 10:32:27 +10:00 committed by GitHub
parent 97ee66e9c0
commit 10dd0300e3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1107,10 +1107,6 @@ final class SyncEngine
if (e.httpStatusCode >= 500) {
// OneDrive returned a 'HTTP 5xx Server Side Error' - gracefully handling error - error message already logged
return;
} else {
// Default operation if not a 500 error
log.error("ERROR: Query of OneDrive for file details failed");
return;
}
}
@ -1122,9 +1118,18 @@ final class SyncEngine
return;
}
auto fileSize = fileDetails["size"].integer;
if (!dryRun) {
ulong fileSize = 0;
if (hasFileSize(fileDetails)) {
// Set the file size from the returned data
fileSize = fileDetails["size"].integer;
} else {
// Issue #540 handling
log.vdebug("ERROR: onedrive.getFileDetails call returned a OneDriveException error");
// We want to return, cant download
return;
}
try {
onedrive.downloadById(item.driveId, item.id, path, fileSize);
} catch (OneDriveException e) {