[Pkg-owncloud-commits] [owncloud-client] 24/211: Selective Sync: ensure that the blacklist contains the last '/'

Sandro Knauß hefee-guest at moszumanska.debian.org
Sat Oct 25 09:10:22 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 6de104a03ad662a5959a374be06b4f55a6eed1ce
Author: Olivier Goffart <ogoffart at woboq.com>
Date:   Thu Oct 9 15:11:04 2014 +0200

    Selective Sync: ensure that the blacklist contains the last '/'
    
    In the sync engine.  Because that makes tha tthe lower_bounds in selective sync works properly.
    
    For example, if both "Test" and "Test Test" are in the list,  then "Test/Foo" would match the "Test Test"
     because slash is after space
    
    Task #2289
---
 src/mirall/discoveryphase.cpp |  7 ++++++-
 src/mirall/syncengine.cpp     | 11 +++++++++++
 src/mirall/syncengine.h       |  3 +--
 3 files changed, 18 insertions(+), 3 deletions(-)

diff --git a/src/mirall/discoveryphase.cpp b/src/mirall/discoveryphase.cpp
index edc2295..d72a084 100644
--- a/src/mirall/discoveryphase.cpp
+++ b/src/mirall/discoveryphase.cpp
@@ -35,11 +35,16 @@ bool DiscoveryJob::isInBlackList(const QString& path) const
 
     auto it = std::lower_bound(_selectiveSyncBlackList.begin(), _selectiveSyncBlackList.end(), pathSlash);
 
+    if (it != _selectiveSyncBlackList.end() && *it == pathSlash) {
+        return true;
+    }
+
 	if (it == _selectiveSyncBlackList.begin()) {
         return false;
     }
     --it;
-    if (pathSlash.startsWith(*it + QLatin1Char('/'))) {
+    Q_ASSERT(*it.endsWith(QLatin1Char('/'))); // SyncEngine::setSelectiveSyncBlackList makes sure of that
+    if (pathSlash.startsWith(*it)) {
         return true;
     }
     return false;
diff --git a/src/mirall/syncengine.cpp b/src/mirall/syncengine.cpp
index 8354fdb..c77d204 100644
--- a/src/mirall/syncengine.cpp
+++ b/src/mirall/syncengine.cpp
@@ -1041,6 +1041,17 @@ QByteArray SyncEngine::getPermissions(const QString& file) const
     return _remotePerms.value(file);
 }
 
+void SyncEngine::setSelectiveSyncBlackList(const QStringList& list)
+{
+    _selectiveSyncBlackList = list;
+    for (int i = 0; i < _selectiveSyncBlackList.count(); ++i) {
+        if (!_selectiveSyncBlackList.at(i).endsWith(QLatin1Char('/'))) {
+            _selectiveSyncBlackList[i].append(QLatin1Char('/'));
+        }
+    }
+}
+
+
 
 void SyncEngine::abort()
 {
diff --git a/src/mirall/syncengine.h b/src/mirall/syncengine.h
index b42ed2c..0b25a43 100644
--- a/src/mirall/syncengine.h
+++ b/src/mirall/syncengine.h
@@ -61,8 +61,7 @@ public:
 
     Utility::StopWatch &stopWatch() { return _stopWatch; }
 
-    void setSelectiveSyncBlackList(const QStringList &list)
-    { _selectiveSyncBlackList = list; }
+    void setSelectiveSyncBlackList(const QStringList &list);
 
     /* Return true if we detected that another sync is needed to complete the sync */
     bool isAnotherSyncNeeded() { return _anotherSyncNeeded; }

-- 
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