mirror of
https://github.com/abraunegg/onedrive
synced 2024-05-06 07:53:16 +02:00
Fix error 'Key not found: remaining' with Business Shared Folders (#1713)
* Fix an API regression where the 'remaining' value for some API responses is no longer present in the 'quota' JSON response
This commit is contained in:
parent
b0a1baeaf4
commit
540c2369f3
19
src/sync.d
19
src/sync.d
|
@ -387,7 +387,15 @@ final class SyncEngine
|
||||||
accountType = oneDriveDetails["driveType"].str;
|
accountType = oneDriveDetails["driveType"].str;
|
||||||
defaultDriveId = oneDriveDetails["id"].str;
|
defaultDriveId = oneDriveDetails["id"].str;
|
||||||
defaultRootId = oneDriveRootDetails["id"].str;
|
defaultRootId = oneDriveRootDetails["id"].str;
|
||||||
remainingFreeSpace = oneDriveDetails["quota"]["remaining"].integer;
|
|
||||||
|
// get the remaining size from OneDrive API
|
||||||
|
if ("remaining" in oneDriveDetails["quota"]){
|
||||||
|
// use the value provided
|
||||||
|
remainingFreeSpace = oneDriveDetails["quota"]["remaining"].integer;
|
||||||
|
} else {
|
||||||
|
// set at zero
|
||||||
|
remainingFreeSpace = 0;
|
||||||
|
}
|
||||||
|
|
||||||
// Make sure that defaultDriveId is in our driveIDs array to use when checking if item is in database
|
// Make sure that defaultDriveId is in our driveIDs array to use when checking if item is in database
|
||||||
// Keep the driveIDsArray with unique entries only
|
// Keep the driveIDsArray with unique entries only
|
||||||
|
@ -1225,9 +1233,12 @@ final class SyncEngine
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// quota details returned, but for a drive id that is not ours
|
// quota details returned, but for a drive id that is not ours
|
||||||
if (currentDriveQuota["quota"]["remaining"].integer <= 0) {
|
if ("remaining" in currentDriveQuota["quota"]){
|
||||||
// value returned is 0 or less than 0
|
// remaining is in the quota JSON response
|
||||||
log.vlog("OneDrive quota information is set at zero, as this is not our drive id, ignoring");
|
if (currentDriveQuota["quota"]["remaining"].integer <= 0) {
|
||||||
|
// value returned is 0 or less than 0
|
||||||
|
log.vlog("OneDrive quota information is set at zero, as this is not our drive id, ignoring");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in a new issue