From 7b4be209aaefe289f96db0b492414cbad1e6dfea Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Tue, 11 Nov 2014 16:27:06 +0100 Subject: [PATCH] MOVE: fix moving with special character. The Destination header need to be %-encoded --- csync/tests/ownCloud/t3.pl | 10 ++++++++++ src/libsync/propagateremotemove.cpp | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/csync/tests/ownCloud/t3.pl b/csync/tests/ownCloud/t3.pl index a27409ef2..55742ec67 100755 --- a/csync/tests/ownCloud/t3.pl +++ b/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); diff --git a/src/libsync/propagateremotemove.cpp b/src/libsync/propagateremotemove.cpp index f092dc121..06084cb02 100644 --- a/src/libsync/propagateremotemove.cpp +++ b/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());