Update sync.d (#422)

* Add a check to validate if 'size' is in the JSON response
This commit is contained in:
abraunegg 2019-03-21 10:29:04 +11:00 committed by GitHub
parent 58c2805237
commit 6b8b51a7cc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1771,7 +1771,9 @@ final class SyncEngine
// Log action to log file
log.fileOnly("Uploading new file ", path, " ... done.");
// The file was uploaded
// The file was uploaded, or a 4xx / 5xx error was generated
if ("size" in response){
// The response JSON contains size, high likelihood valid response returned
ulong uploadFileSize = response["size"].integer;
// In some cases the file that was uploaded was not complete, but 'completed' without errors on OneDrive
@ -1813,6 +1815,7 @@ final class SyncEngine
saveItem(response);
return;
}
}
} else {
// we are --dry-run - simulate the file upload
writeln(" done.");