[Pkg-owncloud-commits] [owncloud-client] 56/94: owncloudcmd: Do not do the capability call when --nonshib is passed

Sandro Knauß hefee at debian.org
Thu Mar 29 11:12:14 UTC 2018


This is an automated email from the git hooks/post-receive script.

hefee pushed a commit to branch upstream
in repository owncloud-client.

commit e720f840057695603744fcc8cf0116b9d8a72acc
Author: Olivier Goffart <ogoffart at woboq.com>
Date:   Wed Jan 24 10:42:58 2018 +0100

    owncloudcmd: Do not do the capability call when --nonshib is passed
    
    https://github.com/owncloud/enterprise/issues/2391
---
 src/cmd/cmd.cpp | 42 ++++++++++++++++++++++++------------------
 1 file changed, 24 insertions(+), 18 deletions(-)

diff --git a/src/cmd/cmd.cpp b/src/cmd/cmd.cpp
index 9385fc7..272f1da 100644
--- a/src/cmd/cmd.cpp
+++ b/src/cmd/cmd.cpp
@@ -455,24 +455,30 @@ int main(int argc, char **argv)
     account->setCredentials(cred);
     account->setSslErrorHandler(sslErrorHandler);
 
-    //obtain capabilities using event loop
-    QEventLoop loop;
-
-    JsonApiJob *job = new JsonApiJob(account, QLatin1String("ocs/v1.php/cloud/capabilities"));
-    job->setTimeout(timeoutToUseMsec);
-    QObject::connect(job, &JsonApiJob::jsonReceived, [&](const QJsonDocument &json) {
-        auto caps = json.object().value("ocs").toObject().value("data").toObject().value("capabilities").toObject();
-        qDebug() << "Server capabilities" << caps;
-        account->setCapabilities(caps.toVariantMap());
-        loop.quit();
-    });
-    job->start();
-
-    loop.exec();
-
-    if (job->reply()->error() != QNetworkReply::NoError){
-        std::cout<<"Error connecting to server\n";
-        return EXIT_FAILURE;
+    // Perform a call to get the capabilities.
+    if (!options.nonShib) {
+        // Do not do it if '--nonshib' was passed. This mean we should only connect to the 'nonshib'
+        // dav endpoint. Since we do not get the capabilities, in that case, this has the additional
+        // side effect that chunking-ng will be disabled. (because otherwise it would use the new
+        // 'dav' endpoint instead of the nonshib one (which still use the old chunking)
+
+        QEventLoop loop;
+        JsonApiJob *job = new JsonApiJob(account, QLatin1String("ocs/v1.php/cloud/capabilities"));
+        job->setTimeout(timeoutToUseMsec);
+        QObject::connect(job, &JsonApiJob::jsonReceived, [&](const QJsonDocument &json) {
+            auto caps = json.object().value("ocs").toObject().value("data").toObject().value("capabilities").toObject();
+            qDebug() << "Server capabilities" << caps;
+            account->setCapabilities(caps.toVariantMap());
+            loop.quit();
+        });
+        job->start();
+
+        loop.exec();
+
+        if (job->reply()->error() != QNetworkReply::NoError){
+            std::cout<<"Error connecting to server\n";
+            return EXIT_FAILURE;
+        }
     }
 
     // much lower age than the default since this utility is usually made to be run right after a change in the tests

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud-client.git



More information about the Pkg-owncloud-commits mailing list