[Pkg-owncloud-commits] [owncloud-client] 11/115: selective sync: fix whitelist matching
Sandro Knauß
hefee-guest at moszumanska.debian.org
Fri Aug 29 22:03:54 UTC 2014
This is an automated email from the git hooks/post-receive script.
hefee-guest pushed a commit to branch master
in repository owncloud-client.
commit 12459bf07e9b17daaf589cb2fc2d50eddc56eb3a
Author: Olivier Goffart <ogoffart at woboq.com>
Date: Tue Aug 12 11:43:42 2014 +0200
selective sync: fix whitelist matching
---
csync/src/csync_exclude.c | 4 ++--
src/mirall/discoveryphase.cpp | 12 ++++++------
2 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/csync/src/csync_exclude.c b/csync/src/csync_exclude.c
index 09af946..6c79f1b 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 b1e485a..8cd5860 100644
--- a/src/mirall/discoveryphase.cpp
+++ b/src/mirall/discoveryphase.cpp
@@ -14,8 +14,9 @@
#include "discoveryphase.h"
#include <csync_private.h>
+#include <qdebug.h>
-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;
}
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud-client.git
More information about the Pkg-owncloud-commits
mailing list