Преглед на файлове

MOVE: fix moving with special character.

The Destination header need to be %-encoded
Olivier Goffart преди 11 години
родител
ревизия
7b4be209aa
променени са 2 файла, в които са добавени 11 реда и са изтрити 1 реда
  1. 10 0
      csync/tests/ownCloud/t3.pl
  2. 1 1
      src/libsync/propagateremotemove.cpp

+ 10 - 0
csync/tests/ownCloud/t3.pl

@@ -141,6 +141,16 @@ move( localDir() . '3.txt', localDir() . '3_bis.txt' );
 system( "echo \"new file un\" > " . localDir() . '1.txt' );
 system( "echo \"new file trois\" > " . localDir() . '3.txt' );
 
+#also add special file with special character for next sync
+#and file with special characters
+createLocalFile(localDir().  'hêllo%20th@re.txt' , 1208 );
+
+csync();
+assertLocalAndRemoteDir( '', 0);
+
+printInfo("Move a file containing special character");
+
+move(localDir().  'hêllo%20th@re.txt', localDir().  'hêllo%20th@re.doc');
 csync();
 assertLocalAndRemoteDir( '', 0);
 

+ 1 - 1
src/libsync/propagateremotemove.cpp

@@ -29,7 +29,7 @@ MoveJob::MoveJob(Account* account, const QString& path,
 void MoveJob::start()
 {
     QNetworkRequest req;
-    req.setRawHeader("Destination", _destination.toUtf8());
+    req.setRawHeader("Destination", QUrl::toPercentEncoding(_destination, "/"));
     setReply(davRequest("MOVE", path(), req));
     setupConnections(reply());