MOVE: fix moving with special character.

The Destination header need to be %-encoded
This commit is contained in:
Olivier Goffart 2014-11-11 16:27:06 +01:00
parent c712b7c46c
commit 7b4be209aa
2 changed files with 11 additions and 1 deletions

View file

@ -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);

View file

@ -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());