From 4f7f415d50139d38f7fb820d5d43d3c044ef16ad Mon Sep 17 00:00:00 2001 From: Jyrki Gadinger Date: Tue, 10 Mar 2026 10:22:58 +0100 Subject: [PATCH] fix(propagateuploadng): do not encode davUrl sabre/dav does not seem to approve of percent-encoded base URLs (e.g. `http%3A//nextcloud.local/...`), it will then consider them as absolute paths and fail. --> adapt fix from #9334 to only encode the remote path, as sabre parses those paths just fine. Resolves: #9582 Signed-off-by: Jyrki Gadinger --- src/libsync/propagateuploadng.cpp | 6 ++++-- test/testchunkingng.cpp | 1 + 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/libsync/propagateuploadng.cpp b/src/libsync/propagateuploadng.cpp index 423eacdd6bb79..261b6e5dd3820 100644 --- a/src/libsync/propagateuploadng.cpp +++ b/src/libsync/propagateuploadng.cpp @@ -25,6 +25,8 @@ #include #include +using namespace Qt::StringLiterals; + namespace OCC { constexpr auto relativeUploadsPath = "remote.php/dav/uploads/"; @@ -80,9 +82,9 @@ QUrl PropagateUploadFileNG::chunkUrl(const int chunk) const QByteArray PropagateUploadFileNG::destinationHeader() const { const auto davUrl = Utility::trailingSlashPath(propagator()->account()->davUrl().toString()); - const auto remotePath = Utility::noLeadingSlashPath(propagator()->fullRemotePath(_fileToUpload._file)); + const auto remotePath = QUrl::toPercentEncoding(Utility::noLeadingSlashPath(propagator()->fullRemotePath(_fileToUpload._file)), "/"_ba); const auto destination = QString(davUrl + remotePath); - return QUrl::toPercentEncoding(destination, "/"); + return destination.toUtf8(); } void PropagateUploadFileNG::doStartUpload() diff --git a/test/testchunkingng.cpp b/test/testchunkingng.cpp index 636729bf71294..9edac17942c4f 100644 --- a/test/testchunkingng.cpp +++ b/test/testchunkingng.cpp @@ -151,6 +151,7 @@ private slots: QVERIFY(destinationHeader.contains("SQ-0.5%25BF-150")); QVERIFY(destinationHeader.contains("/A/SQ-0.5%25BF-150/")); QVERIFY(!destinationHeader.contains("%2F")); + QVERIFY(destinationHeader.startsWith("http://")); } // Test resuming when there's a confusing chunk added