Add a check to handle moving items out of sync scope & delete locally if true (#604)

* Add a check to handle moving items out of sync scope & delete locally if true
This commit is contained in:
abraunegg 2019-07-30 07:02:24 +10:00 committed by GitHub
parent 3171318503
commit 8f71043f23
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -842,8 +842,26 @@ final class SyncEngine
}
bool unwanted;
unwanted |= skippedItems.find(item.parentId).length != 0;
if (unwanted) log.vdebug("Flagging as unwanted: find(item.parentId).length != 0");
// Check if the parent id is something we need to skip
if (skippedItems.find(item.parentId).length != 0) {
// Potentially need to flag as unwanted
log.vdebug("Flagging as unwanted: find(item.parentId).length != 0");
unwanted = true;
// 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];
}
}
}
// Check if this is a directory to skip
if (!unwanted) {
// Only check path if config is != ""