diff --git a/csync/src/csync_exclude.c b/csync/src/csync_exclude.c index 09af94699c..6c79f1bc48 100644 --- a/csync/src/csync_exclude.c +++ b/csync/src/csync_exclude.c @@ -311,8 +311,8 @@ CSYNC_EXCLUDE_TYPE csync_excluded(CSYNC *ctx, const char *path, int filetype) { } if (match == CSYNC_NOT_EXCLUDED && ctx->checkWhiteListHook) { - if (ctx->checkWhiteListHook(ctx->checkWhiteListData, path)) { - match = CSYNC_FILE_SILENTLY_EXCLUDED; + if (!ctx->checkWhiteListHook(ctx->checkWhiteListData, path)) { + match = CSYNC_FILE_EXCLUDE_LIST; } } diff --git a/src/mirall/discoveryphase.cpp b/src/mirall/discoveryphase.cpp index b1e485a137..8cd5860ed9 100644 --- a/src/mirall/discoveryphase.cpp +++ b/src/mirall/discoveryphase.cpp @@ -14,8 +14,9 @@ #include "discoveryphase.h" #include +#include -bool DiscoveryJob::isInWhiteList(const QString& path_) const +bool DiscoveryJob::isInWhiteList(const QString& path) const { if (_selectiveSyncWhiteList.isEmpty()) { // If there is no white list, everything is allowed @@ -32,10 +33,10 @@ bool DiscoveryJob::isInWhiteList(const QString& path_) const // equal, or right after in the lexical order. // If an item has the path as a prefix, it will be right before in the lexicographic order. - QString path = path_ + QLatin1Char('/'); + QString pathSlash = path + QLatin1Char('/'); - auto it = std::lower_bound(_selectiveSyncWhiteList.begin(), _selectiveSyncWhiteList.end(), path); - if (it != _selectiveSyncWhiteList.end() && path.startsWith(*it)) { + auto it = std::lower_bound(_selectiveSyncWhiteList.begin(), _selectiveSyncWhiteList.end(), pathSlash); + if (it != _selectiveSyncWhiteList.end() && (*it + QLatin1Char('/')).startsWith(pathSlash)) { // If the path is a prefix of something in the white list, we need to sync the contents return true; } @@ -45,10 +46,9 @@ bool DiscoveryJob::isInWhiteList(const QString& path_) const return false; } --it; - if ((*it).startsWith(path)) { + if (pathSlash.startsWith(*it + QLatin1Char('/'))) { return true; } - return false; }