mirror of
https://github.com/abraunegg/onedrive
synced 2024-05-17 21:26:41 +02:00
Fix application crash with --get-O365-drive-id when API response is restricted (#1198)
* Check OneDrive API response for required elements before attempting to use elements for next query
This commit is contained in:
parent
8c6d1d19b8
commit
62a2b4f393
10
src/sync.d
10
src/sync.d
|
@ -5360,6 +5360,9 @@ final class SyncEngine
|
|||
foreach (searchResult; siteQuery["value"].array) {
|
||||
// Need an 'exclusive' match here with o365SharedLibraryName as entered
|
||||
log.vdebug("Found O365 Site: ", searchResult);
|
||||
|
||||
// 'displayName', 'id' and 'webUrl' have to be present in the search result record
|
||||
if (("displayName" in searchResult) && ("id" in searchResult) && ("webUrl" in searchResult)) {
|
||||
if (o365SharedLibraryName == searchResult["displayName"].str){
|
||||
// 'displayName' matches search request
|
||||
site_id = searchResult["id"].str;
|
||||
|
@ -5392,6 +5395,13 @@ final class SyncEngine
|
|||
return;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// 'displayName' not present in JSON results
|
||||
log.error("ERROR: The results returned from OneDrive API do not contain the required items to match. Please check your permissions with your site administrator.");
|
||||
log.error("ERROR: Your site security settings is preventing the following details from being accessed: 'displayName', 'id' and 'webUrl'");
|
||||
log.error("ERROR: To debug this further, please use --verbose --verbose to provide insight as to what details are actually returned.");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if(!found) {
|
||||
|
|
Loading…
Reference in a new issue