[Pkg-owncloud-commits] [owncloud-client] 28/211: Selective sync: do not upload or rename file that would ends up in a not selected folder
Sandro Knauß
hefee-guest at moszumanska.debian.org
Sat Oct 25 09:10:23 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 4c83653d5dab5e2b75f22b18d7f9980990904aac
Author: Olivier Goffart <ogoffart at woboq.com>
Date: Thu Oct 9 16:43:56 2014 +0200
Selective sync: do not upload or rename file that would ends up in a not selected folder
Issue #2283
---
src/mirall/syncengine.cpp | 32 +++++++++++++++++++++++++-------
1 file changed, 25 insertions(+), 7 deletions(-)
diff --git a/src/mirall/syncengine.cpp b/src/mirall/syncengine.cpp
index c77d204..3c68e08 100644
--- a/src/mirall/syncengine.cpp
+++ b/src/mirall/syncengine.cpp
@@ -820,6 +820,11 @@ QString SyncEngine::adjustRenamedPath(const QString& original)
return original;
}
+/**
+ *
+ * Make sure that we are allowed to do what we do by checking the permissions and the selective sync list
+ *
+ */
void SyncEngine::checkForPermission()
{
for (SyncFileItemVector::iterator it = _syncedItems.begin(); it != _syncedItems.end(); ++it) {
@@ -829,6 +834,25 @@ void SyncEngine::checkForPermission()
continue;
}
+ // Do not propagate anything in the server if it is in the selective sync blacklist
+ const QString path = it->destination() + QLatin1Char('/');
+ if (std::binary_search(_selectiveSyncBlackList.constBegin(), _selectiveSyncBlackList.constEnd(),
+ path)) {
+ it->_instruction = CSYNC_INSTRUCTION_IGNORE;
+ it->_status = SyncFileItem::FileIgnored;
+ it->_errorString = tr("Ignored because of the \"choose what to sync\" blacklist");
+
+ if (it->_isDirectory) {
+ for (SyncFileItemVector::iterator it_next = it + 1; it_next != _syncedItems.end() && it_next->_file.startsWith(path); ++it_next) {
+ it = it_next;
+ it->_instruction = CSYNC_INSTRUCTION_IGNORE;
+ it->_status = SyncFileItem::FileIgnored;
+ it->_errorString = tr("Ignored because of the \"choose what to sync\" blacklist");
+ }
+ }
+ continue;
+ }
+
switch(it->_instruction) {
case CSYNC_INSTRUCTION_NEW: {
int slashPos = it->_file.lastIndexOf('/');
@@ -843,7 +867,6 @@ void SyncEngine::checkForPermission()
it->_status = SyncFileItem::NormalError;
it->_errorString = tr("Not allowed because you don't have permission to add sub-directories in that directory");
- const QString path = it->_file + QLatin1Char('/');
for (SyncFileItemVector::iterator it_next = it + 1; it_next != _syncedItems.end() && it_next->_file.startsWith(path); ++it_next) {
it = it_next;
it->_instruction = CSYNC_INSTRUCTION_ERROR;
@@ -896,7 +919,6 @@ void SyncEngine::checkForPermission()
if (it->_isDirectory) {
// restore all sub items
- const QString path = it->_file + QLatin1Char('/');
for (SyncFileItemVector::iterator it_next = it + 1;
it_next != _syncedItems.end() && it_next->_file.startsWith(path); ++it_next) {
it = it_next;
@@ -916,8 +938,7 @@ void SyncEngine::checkForPermission()
it->_errorString = tr("Not allowed to remove, restoring");
}
}
- }
- if(perms.contains("S") && perms.contains("D")) {
+ } else if(perms.contains("S") && perms.contains("D")) {
// this is a top level shared dir which can be removed to unshare it,
// regardless if it is a read only share or not.
// To avoid that we try to restore files underneath this dir which have
@@ -926,8 +947,6 @@ void SyncEngine::checkForPermission()
// underneath, propagator sees that.
if( it->_isDirectory ) {
SyncFileItemVector::iterator it_prev = it - 1;
- const QString path = it->_file + QLatin1Char('/');
-
// put a more descriptive message if really a top level share dir is removed.
if( it_prev != _syncedItems.begin() && !(path.startsWith(it_prev->_file)) ) {
@@ -1010,7 +1029,6 @@ void SyncEngine::checkForPermission()
if (it->_isDirectory) {
- const QString path = it->_renameTarget + QLatin1Char('/');
for (SyncFileItemVector::iterator it_next = it + 1;
it_next != _syncedItems.end() && it_next->destination().startsWith(path); ++it_next) {
it = it_next;
--
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