@@ -127,6 +127,32 @@ private slots:
127127 QCOMPARE (fakeFolder.uploadState ().children .count (), 2 ); // the transfer was done with chunking
128128 }
129129
130+ void testDestinationHeaderPercentEncoding ()
131+ {
132+ FakeFolder fakeFolder{FileInfo::A12_B12_C12_S12 ()};
133+ fakeFolder.syncEngine ().account ()->setCapabilities ({ { " dav" , QVariantMap{ {" chunking" , " 1.0" } } } });
134+ setChunkSize (fakeFolder.syncEngine (), 1 * 1000 * 1000 );
135+
136+ QByteArray destinationHeader;
137+ fakeFolder.setServerOverride ([&destinationHeader](QNetworkAccessManager::Operation, const QNetworkRequest &request, QIODevice *) -> QNetworkReply * {
138+ if (destinationHeader.isEmpty () && request.hasRawHeader (" Destination" )) {
139+ destinationHeader = request.rawHeader (" Destination" );
140+ }
141+ return nullptr ;
142+ });
143+
144+ const QString filePath = QStringLiteral (" A/SQ-0.5%BF-150/a0" );
145+ const int size = 2 * 1000 * 1000 ; // 2 MB
146+
147+ fakeFolder.localModifier ().mkdir (QStringLiteral (" A/SQ-0.5%BF-150" ));
148+ fakeFolder.localModifier ().insert (filePath, size);
149+ QVERIFY (fakeFolder.syncOnce ());
150+ QVERIFY (!destinationHeader.isEmpty ());
151+ QVERIFY (destinationHeader.contains (" SQ-0.5%25BF-150" ));
152+ QVERIFY (destinationHeader.contains (" /A/SQ-0.5%25BF-150/" ));
153+ QVERIFY (!destinationHeader.contains (" %2F" ));
154+ }
155+
130156 // Test resuming when there's a confusing chunk added
131157 void testResume1 () {
132158 FakeFolder fakeFolder{FileInfo::A12_B12_C12_S12 ()};
0 commit comments