From fbad4b483558c223b998fc00cae0e5fa8b588f50 Mon Sep 17 00:00:00 2001 From: abraunegg Date: Thu, 25 Apr 2019 11:00:23 +1000 Subject: [PATCH] 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 --- src/main.d | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/main.d b/src/main.d index 3032dee1..701c4e64 100644 --- a/src/main.d +++ b/src/main.d @@ -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);