mirror of
https://github.com/abraunegg/onedrive
synced 2024-05-10 01:36:39 +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
17
src/sync.d
17
src/sync.d
|
@ -5696,8 +5696,21 @@ final class SyncEngine
|
||||||
// Add to siteSearchResults so we can display what we did find
|
// Add to siteSearchResults so we can display what we did find
|
||||||
string siteSearchResultsEntry;
|
string siteSearchResultsEntry;
|
||||||
foreach (searchResult; siteQuery["value"].array) {
|
foreach (searchResult; siteQuery["value"].array) {
|
||||||
siteSearchResultsEntry = " * " ~ searchResult["displayName"].str;
|
// We can only add the displayName if it is available
|
||||||
siteSearchResults ~= siteSearchResultsEntry;
|
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 {
|
} else {
|
||||||
|
|
Loading…
Reference in a new issue