[Pkg-owncloud-commits] [owncloud-client] 114/211: Propagator: Fix renaming of files and case confflicts

Sandro Knauß hefee-guest at moszumanska.debian.org
Sat Oct 25 09:10:34 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 a5bd437d4844fd45fdfe4c9cb12915eb0418d336
Author: Olivier Goffart <ogoffart at woboq.com>
Date:   Fri Oct 17 16:11:25 2014 +0200

    Propagator: Fix renaming of files and case confflicts
    
    Better fix for #1385 and #2318
---
 csync/tests/ownCloud/t8.pl    | 9 ++++++++-
 src/mirall/propagatorjobs.cpp | 6 +++++-
 2 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/csync/tests/ownCloud/t8.pl b/csync/tests/ownCloud/t8.pl
index 883a959..b1138f5 100755
--- a/csync/tests/ownCloud/t8.pl
+++ b/csync/tests/ownCloud/t8.pl
@@ -48,6 +48,7 @@ mkdir($tmpdir);
 createLocalFile( $tmpdir . "HELLO.dat", 100 );
 createLocalFile( $tmpdir . "Hello.dat", 150 );
 createLocalFile( $tmpdir . "Normal.dat", 110 );
+createLocalFile( $tmpdir . "test.dat", 170 );
 
 #put them in some directories
 createRemoteDir( "dir" );
@@ -73,14 +74,20 @@ assertLocalAndRemoteDir( '', 0);
 
 printInfo( "Renaming one file to the same name as another one with different casing" );
 moveRemoteFile( 'dir/Hello.dat', 'dir/NORMAL.dat');
+moveRemoteFile( 'dir/test.dat', 'dir/TEST.dat');
 
 csync();
 
-#It should not have do the move
+# Hello -> NORMAL should not have do the move since the case conflict
 assert( -e localDir() . 'dir/Hello.dat' );
 assert( !-e localDir() . 'dir/NORMAL.dat' );
 assert( -e localDir() . 'dir/Normal.dat' );
 
+#test->TEST should have been worked.
+assert( -e localDir() . 'dir/TEST.dat' );
+assert( !-e localDir() . 'dir/test.dat' );
+
+
 printInfo( "Another directory with the same name but different casing is created" );
 
 createRemoteDir( "DIR" );
diff --git a/src/mirall/propagatorjobs.cpp b/src/mirall/propagatorjobs.cpp
index da784f7..f3895e0 100644
--- a/src/mirall/propagatorjobs.cpp
+++ b/src/mirall/propagatorjobs.cpp
@@ -247,7 +247,11 @@ void PropagateLocalRename::start()
         qDebug() << "MOVE " << _propagator->_localDir + _item._file << " => " << _propagator->_localDir + _item._renameTarget;
         QFile file(_propagator->_localDir + _item._file);
 
-        if (_propagator->localFileNameClash(_item._renameTarget)) {
+        if (QString::compare(_item._file, _item._renameTarget, Qt::CaseInsensitive) != 0
+                && _propagator->localFileNameClash(_item._renameTarget)) {
+            // Only use localFileNameClash for the destination if we know that the source was not
+            // the one conflicting  (renaming  A.txt -> a.txt is OK)
+
             // Fixme: the file that is the reason for the clash could be named here,
             // it would have to come out the localFileNameClash function
             done(SyncFileItem::NormalError, tr( "File %1 can not be renamed to %2 because of a local file name clash")

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