mirror of
https://github.com/nextcloud/desktop.git
synced 2024-10-25 05:45:42 +03:00
Make sure to encode the relPath
Signed-off-by: Claudio Cambra <claudio.cambra@nextcloud.com>
This commit is contained in:
parent
8683ee08e7
commit
0c6127de44
1 changed files with 4 additions and 2 deletions
|
@ -1534,10 +1534,12 @@ void FolderMan::editFileLocally(const QString &userId, const QString &relPath, c
|
||||||
}
|
}
|
||||||
|
|
||||||
// Sanitise the token
|
// 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));
|
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->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) {
|
connect(checkTokenForEditLocally, &SimpleApiJob::resultReceived, checkTokenForEditLocally, [this, folderForFile, localFilePath, showError, accountFound, relPath] (int statusCode) {
|
||||||
constexpr auto HTTP_OK_CODE = 200;
|
constexpr auto HTTP_OK_CODE = 200;
|
||||||
if (statusCode != HTTP_OK_CODE) {
|
if (statusCode != HTTP_OK_CODE) {
|
||||||
|
|
Loading…
Reference in a new issue