Skip to content

Commit 0b75988

Browse files
authored
Merge pull request #9588 from nextcloud/bugfix/9582/percent-encoding-chunked-uploads
fix(propagateuploadng): do not encode davUrl
2 parents 9b05ecb + 0214fc7 commit 0b75988

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

src/libsync/propagateuploadng.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@
2525
#include <cmath>
2626
#include <cstring>
2727

28+
using namespace Qt::StringLiterals;
29+
2830
namespace OCC {
2931

3032
constexpr auto relativeUploadsPath = "remote.php/dav/uploads/";
@@ -80,9 +82,9 @@ QUrl PropagateUploadFileNG::chunkUrl(const int chunk) const
8082
QByteArray PropagateUploadFileNG::destinationHeader() const
8183
{
8284
const auto davUrl = Utility::trailingSlashPath(propagator()->account()->davUrl().toString());
83-
const auto remotePath = Utility::noLeadingSlashPath(propagator()->fullRemotePath(_fileToUpload._file));
85+
const auto remotePath = QUrl::toPercentEncoding(Utility::noLeadingSlashPath(propagator()->fullRemotePath(_fileToUpload._file)), "/"_ba);
8486
const auto destination = QString(davUrl + remotePath);
85-
return QUrl::toPercentEncoding(destination, "/");
87+
return destination.toUtf8();
8688
}
8789

8890
void PropagateUploadFileNG::doStartUpload()

test/testchunkingng.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,7 @@ private slots:
151151
QVERIFY(destinationHeader.contains("SQ-0.5%25BF-150"));
152152
QVERIFY(destinationHeader.contains("/A/SQ-0.5%25BF-150/"));
153153
QVERIFY(!destinationHeader.contains("%2F"));
154+
QVERIFY(destinationHeader.startsWith("http://"));
154155
}
155156

156157
// Test resuming when there's a confusing chunk added

0 commit comments

Comments
 (0)