Fix 'key not found: name' when checking if item was synced (#645)

* Fix searching for 'name' when deleting a synced item, if the OneDrive API does not return the expected details in the API call
This commit is contained in:
abraunegg 2019-09-06 12:30:33 +10:00 committed by GitHub
parent e8c3c236ef
commit 90a28e0f6c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -871,13 +871,15 @@ final class SyncEngine
// Is this item id in the database?
if (itemdb.idInLocalDatabase(item.driveId, item.id)){
// item exists in database, most likely moved out of scope for current client configuration
log.vdebug("This item was previously synced / seen by the client");
if (selectiveSync.isPathExcluded(driveItem["parentReference"]["name"].str)) {
// Previously synced item is now out of scope as it has been moved out of what is included in sync_list
log.vdebug("This previously synced item is now excluded from being synced due to sync_list exclusion");
// flag to delete local file as it now is no longer in sync with OneDrive
log.vdebug("Flagging to delete item locally");
idsToDelete ~= [item.driveId, item.id];
log.vdebug("This item was previously synced / seen by the client");
if (("name" in driveItem["parentReference"]) != null) {
if (selectiveSync.isPathExcluded(driveItem["parentReference"]["name"].str)) {
// Previously synced item is now out of scope as it has been moved out of what is included in sync_list
log.vdebug("This previously synced item is now excluded from being synced due to sync_list exclusion");
// flag to delete local file as it now is no longer in sync with OneDrive
log.vdebug("Flagging to delete item locally");
idsToDelete ~= [item.driveId, item.id];
}
}
}
}