diff --git a/src/cmd/cmd.cpp b/src/cmd/cmd.cpp index 78be38da19d61..d55582588d64a 100644 --- a/src/cmd/cmd.cpp +++ b/src/cmd/cmd.cpp @@ -547,6 +547,15 @@ int main(int argc, char **argv) // Always try to load the user-provided exclude list if one is specified if (hasUserExcludeFile) { + if (!QFile::exists(options.exclude)) { + // A user-supplied --exclude path that can't be found is a + // configuration error, not something to silently ignore: + // reloadExcludeFiles() below drops missing files without + // failing, which previously made the whole sync run with + // no exclusions and no diagnostic (see nextcloud/desktop#4621). + qFatal("Exclude list file supplied via --exclude does not exist: %s", qUtf8Printable(options.exclude)); + return EXIT_FAILURE; + } engine.excludedFiles().addExcludeFilePath(options.exclude); } // Load the system list if available, or if there's no user-provided list diff --git a/src/csync/csync_exclude.cpp b/src/csync/csync_exclude.cpp index 72e585aea7bc1..438fa9aac3851 100644 --- a/src/csync/csync_exclude.cpp +++ b/src/csync/csync_exclude.cpp @@ -346,6 +346,7 @@ bool ExcludedFiles::reloadExcludeFiles() const auto &excludeFile = *excludeFileIt; QFile file(excludeFile); if (!file.exists()) { + qWarning() << "Exclude list file does not exist, skipping:" << excludeFile; excludeFileIt = excludeFiles.erase(excludeFileIt); continue; }