mirror of
https://github.com/abraunegg/onedrive
synced 2024-05-09 17:26:47 +02:00
Fix application crash when SharePoint displayName is being withheld when using --get-O365-drive-id (#1445)
* Handle bad ShaprePoint data when the API does not return the expected data points when using those references to display what SharePoint sites are available when using --get-O365-drive-id
This commit is contained in:
parent
c9ca00466a
commit
b0771f79e1
13
src/sync.d
13
src/sync.d
|
@ -5696,8 +5696,21 @@ final class SyncEngine
|
|||
// Add to siteSearchResults so we can display what we did find
|
||||
string siteSearchResultsEntry;
|
||||
foreach (searchResult; siteQuery["value"].array) {
|
||||
// We can only add the displayName if it is available
|
||||
if ("displayName" in searchResult) {
|
||||
// Use the displayName
|
||||
siteSearchResultsEntry = " * " ~ searchResult["displayName"].str;
|
||||
siteSearchResults ~= siteSearchResultsEntry;
|
||||
} else {
|
||||
// Add, but indicate displayName unavailable, use id
|
||||
if ("id" in searchResult) {
|
||||
siteSearchResultsEntry = " * " ~ "Unknown displayName (Data not provided by API), Site ID: " ~ searchResult["id"].str;
|
||||
siteSearchResults ~= siteSearchResultsEntry;
|
||||
} else {
|
||||
// displayName and id unavailable, display in debug log the entry
|
||||
log.vdebug("Bad SharePoint Data for site: ", searchResult);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
|
Loading…
Reference in a new issue