From: Claudio Cambra Date: Thu, 27 Oct 2022 14:32:51 +0000 (+0200) Subject: Use addQueryParams for checkTokenForEditLocally SimpleApiJob X-Git-Tag: archive/raspbian/3.16.7-1_deb13u1+rpi1~1^2~12^2~11^2~179^2 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=734c986cd1234ed9e5c54e3cc03294ee11cf7e40;p=nextcloud-desktop.git Use addQueryParams for checkTokenForEditLocally SimpleApiJob Signed-off-by: Claudio Cambra --- diff --git a/src/gui/folderman.cpp b/src/gui/folderman.cpp index 46e586b89..44bc904d6 100644 --- a/src/gui/folderman.cpp +++ b/src/gui/folderman.cpp @@ -1554,13 +1554,14 @@ void FolderMan::editFileLocally(const QString &userId, const QString &relPath, c return; } - // Sanitise the token - const auto encodedToken = QString::fromUtf8(QUrl::toPercentEncoding(token)); - // Sanitise the relPath - const auto encodedRelPath = QUrl::toPercentEncoding(relPath); + const auto encodedToken = QString::fromUtf8(QUrl::toPercentEncoding(token)); // Sanitise the token + const auto encodedRelPath = QUrl::toPercentEncoding(slashPrefixedPath); // Sanitise the relPath const auto checkTokenForEditLocally = new SimpleApiJob(accountFound->account(), QStringLiteral("/ocs/v2.php/apps/files/api/v1/openlocaleditor/%1").arg(encodedToken)); + + QUrlQuery params; + params.addQueryItem(QStringLiteral("path"), slashPrefixedPath); + checkTokenForEditLocally->addQueryParams(params); checkTokenForEditLocally->setVerb(SimpleApiJob::Verb::Post); - 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) {