[Pkg-owncloud-commits] [owncloud-client] 263/470: SyncEngine: fixed restoring files when they are moved in a new directory

Sandro Knauß hefee-guest at moszumanska.debian.org
Thu May 12 16:25:11 UTC 2016


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 434d16941b78b32284dbff8655773a12083859db
Author: Olivier Goffart <ogoffart at woboq.com>
Date:   Mon Apr 4 10:41:12 2016 +0200

    SyncEngine: fixed restoring files when they are moved in a new directory
    
    Imagine tgus scenario on a read only share that you move file from
    one location to a new directory in the read only share.
    Creating the read only directory fails for permission error.
    But we should also restore the files that have been moved.
    
    IL issue 542
---
 src/libsync/syncengine.cpp | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/src/libsync/syncengine.cpp b/src/libsync/syncengine.cpp
index 9760844..8a19fdc 100644
--- a/src/libsync/syncengine.cpp
+++ b/src/libsync/syncengine.cpp
@@ -1043,8 +1043,17 @@ void SyncEngine::checkForPermission()
                     (*it)->_status = SyncFileItem::NormalError;
                     (*it)->_errorString = tr("Not allowed because you don't have permission to add subfolders to that folder");
 
-                    for (SyncFileItemVector::iterator it_next = it + 1; it_next != _syncedItems.end() && (*it_next)->_file.startsWith(path); ++it_next) {
+                    for (SyncFileItemVector::iterator it_next = it + 1; it_next != _syncedItems.end() && (*it_next)->destination().startsWith(path); ++it_next) {
                         it = it_next;
+                        if ((*it)->_instruction == CSYNC_INSTRUCTION_RENAME) {
+                            // The file was most likely moved in this directory.
+                            // If the file was read only or could not be moved or removed, it should
+                            // be restored. Do that in the next sync by not considering as a rename
+                            // but delete and upload. It will then be restored if needed.
+                            _journal->avoidRenamesOnNextSync((*it)->_file);
+                            _anotherSyncNeeded = true;
+                            qDebug() << "Moving of " << (*it)->_file << " canceled because no permission to add parent folder";
+                        }
                         (*it)->_instruction = CSYNC_INSTRUCTION_ERROR;
                         (*it)->_status = SyncFileItem::NormalError;
                         (*it)->_errorString = tr("Not allowed because you don't have permission to add parent folder");

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