diff options
author | Hannah von Reth <hannah.vonreth@owncloud.com> | 2022-06-30 16:30:18 +0300 |
---|---|---|
committer | Hannah von Reth <vonreth@kde.org> | 2022-06-30 17:42:51 +0300 |
commit | efa21135ad7fa35c8bb5623e906f784296b92035 (patch) | |
tree | 2848adea850e4b91749e88e68f466d1c9e0d0cbd /src/libsync | |
parent | 8472fd0e44fab168d5992e2c3d70ac90b6520809 (diff) |
Don't query private links if disabled on the server
Fixes: #8998
Diffstat (limited to 'src/libsync')
-rw-r--r-- | src/libsync/networkjobs.cpp | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/src/libsync/networkjobs.cpp b/src/libsync/networkjobs.cpp index 75728f0c8..d718fdebe 100644 --- a/src/libsync/networkjobs.cpp +++ b/src/libsync/networkjobs.cpp @@ -32,8 +32,8 @@ #include <QPainterPath> #endif -#include "networkjobs.h" #include "account.h" +#include "networkjobs.h" #include "owncloudpropagator.h" #include "creds/abstractcredentials.h" @@ -607,17 +607,19 @@ void SimpleNetworkJob::newReplyHook(QNetworkReply *reply) void fetchPrivateLinkUrl(AccountPtr account, const QUrl &baseUrl, const QString &remotePath, QObject *target, std::function<void(const QString &url)> targetFun) { - // Retrieve the new link by PROPFIND - PropfindJob *job = new PropfindJob(account, baseUrl, remotePath, target); - job->setProperties({ QByteArrayLiteral("http://owncloud.org/ns:privatelink") }); - job->setTimeout(10s); - QObject::connect(job, &PropfindJob::result, target, [=](const QMap<QString, QString> &result) { - auto privateLinkUrl = result[QStringLiteral("privatelink")]; - if (!privateLinkUrl.isEmpty()) { - targetFun(privateLinkUrl); - } - }); - job->start(); + if (account->capabilities().privateLinkPropertyAvailable()) { + // Retrieve the new link by PROPFIND + PropfindJob *job = new PropfindJob(account, baseUrl, remotePath, target); + job->setProperties({ QByteArrayLiteral("http://owncloud.org/ns:privatelink") }); + job->setTimeout(10s); + QObject::connect(job, &PropfindJob::result, target, [=](const QMap<QString, QString> &result) { + auto privateLinkUrl = result[QStringLiteral("privatelink")]; + if (!privateLinkUrl.isEmpty()) { + targetFun(privateLinkUrl); + } + }); + job->start(); + } } } // namespace OCC |