Fix 'Local files not deleted' when using bad 'skip_file' entry (#480)

* Add a check for bad 'skip_file' entry that prevents incorrect searching of local changes (mainly deletes) from being synced
This commit is contained in:
abraunegg 2019-04-25 11:00:23 +10:00 committed by GitHub
parent daec620c1a
commit fbad4b4835
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -282,9 +282,20 @@ int main(string[] args)
log.vdebug("skip_dir: ", cfg.getValueString("skip_dir"));
selectiveSync.setDirMask(cfg.getValueString("skip_dir"));
log.vdebug("Configuring skip_file ...");
// Validate skip_file to ensure that this does not contain an invalid configuration
// Do not use a skip_file entry of .* as this will prevent correct searching of local changes to process.
foreach(entry; cfg.getValueString("skip_file").split("|")){
if (entry == ".*") {
// invalid entry element detected
log.logAndNotify("ERROR: Invalid skip_file entry '.*' detected");
return EXIT_FAILURE;
}
}
// valid entry
log.vdebug("skip_file: ", cfg.getValueString("skip_file"));
selectiveSync.setFileMask(cfg.getValueString("skip_file"));
// Initialize the sync engine
log.logAndNotify("Initializing the Synchronization Engine ...");
auto sync = new SyncEngine(cfg, oneDrive, itemDb, selectiveSync);