]> dgit.raspbian.org Git - nextcloud-desktop.git/commitdiff
Recall: Copy instead of move recalled file #5150
authorChristian Kamm <mail@ckamm.de>
Tue, 6 Sep 2016 08:42:59 +0000 (10:42 +0200)
committerChristian Kamm <mail@ckamm.de>
Mon, 12 Sep 2016 12:09:12 +0000 (14:09 +0200)
That was an unintentional change in
2662203fb7277d5d1a57cef556279f8cd3b974f5

Also expand the test case to cover this.

(cherry picked from commit af9c4d0e2fe1a42e1faf14779ca5ef1088bd1314)

csync/tests/ownCloud/t_recall.pl
src/libsync/propagatedownload.cpp

index 008cad8fd34ef263b49827b389539b1e0f3a271c..244618cf852f4372ba4edfc5de00b204597da01a 100755 (executable)
@@ -64,6 +64,10 @@ csync();
 assert( -e glob(localDir().'dir/file2_.sys.admin#recall#-*.dat' ) );
 assert( -e glob(localDir().'dir/file3_.sys.admin#recall#-*.dat' ) );
 
+# verify that the original files still exist
+assert( -e glob(localDir().'dir/file2.dat' ) );
+assert( -e glob(localDir().'dir/file3.dat' ) );
+
 #Remove the recall file
 unlink(localDir() . ".sys.admin#recall#");
 
index 306788388beda00d697641c7673059303a20c01a..27a214d75f39926799e5a7284f69714b8656e636 100644 (file)
@@ -638,8 +638,9 @@ static void handleRecallFile(const QString &fn)
         QString rpath = makeRecallFileName(fpath);
 
         qDebug() << "Copy recall file: " << fpath << " -> " << rpath;
-        QString error;
-        FileSystem::uncheckedRenameReplace(fpath, rpath, &error);
+        // Remove the target first, QFile::copy will not overwrite it.
+        FileSystem::remove(rpath);
+        QFile::copy(fpath, rpath);
     }
 }