From: Claudio Cambra Date: Tue, 25 Oct 2022 17:19:43 +0000 (+0200) Subject: Make sure to encode the relPath X-Git-Tag: archive/raspbian/3.16.7-1_deb13u1+rpi1~1^2~12^2~11^2~179^2~2 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=0c6127de44b0d537cfe232caf08940f792e2bcfb;p=nextcloud-desktop.git Make sure to encode the relPath Signed-off-by: Claudio Cambra --- diff --git a/src/gui/folderman.cpp b/src/gui/folderman.cpp index da1785897..412910f94 100644 --- a/src/gui/folderman.cpp +++ b/src/gui/folderman.cpp @@ -1534,10 +1534,12 @@ void FolderMan::editFileLocally(const QString &userId, const QString &relPath, c } // Sanitise the token - const auto encodedToken = QString(QUrl::toPercentEncoding(token)); + const auto encodedToken = QString::fromUtf8(QUrl::toPercentEncoding(token)); + // Sanitise the relPath + const auto encodedRelPath = QUrl::toPercentEncoding(relPath); const auto checkTokenForEditLocally = new SimpleApiJob(accountFound->account(), QStringLiteral("/ocs/v2.php/apps/files/api/v1/openlocaleditor/%1").arg(encodedToken)); checkTokenForEditLocally->setVerb(SimpleApiJob::Verb::Post); - checkTokenForEditLocally->setBody(QByteArray{"path=/"}.append(relPath.toUtf8())); + checkTokenForEditLocally->setBody(QByteArray{"path=/"}.append(encodedRelPath)); connect(checkTokenForEditLocally, &SimpleApiJob::resultReceived, checkTokenForEditLocally, [this, folderForFile, localFilePath, showError, accountFound, relPath] (int statusCode) { constexpr auto HTTP_OK_CODE = 200; if (statusCode != HTTP_OK_CODE) {