Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Unverified Commit f5b78ac4 authored by AndyScherzinger's avatar AndyScherzinger
Browse files

Merge branch 'master' of https://github.com/nextcloud/android-library into externalFolderIcon2

parents fbeb58c8 bbf8d154
Loading
Loading
Loading
Loading
+13 −0
Original line number Diff line number Diff line
@@ -473,4 +473,17 @@ public class OwnCloudClient extends HttpClient {
    public OwnCloudVersion getOwnCloudVersion(){
        return mVersion;
    }

    public void setUseNextcloudUserAgent(boolean nextcloudUserAgent) {
        mUseNextcloudUserAgent = nextcloudUserAgent;

        String userAgent = nextcloudUserAgent ? OwnCloudClientManagerFactory.getNextcloudUserAgent() :
                OwnCloudClientManagerFactory.getUserAgent();

        getParams().setParameter(HttpMethodParams.USER_AGENT, userAgent);
    }

    public boolean useNextcloudUserAgent() {
        return mUseNextcloudUserAgent;
    }
}
+1 −7
Original line number Diff line number Diff line
@@ -40,8 +40,6 @@ import com.owncloud.android.lib.common.accounts.AccountUtils;
import com.owncloud.android.lib.common.operations.RemoteOperationResult.ResultCode;
import com.owncloud.android.lib.common.utils.Log_OC;

import org.apache.commons.httpclient.params.HttpMethodParams;

import java.io.IOException;


@@ -142,11 +140,7 @@ public abstract class RemoteOperation implements Runnable {
            throw new IllegalArgumentException("Trying to execute a remote operation with a NULL " +
                    "OwnCloudClient");
		mClient = client;

        if (useNextcloudUserAgent) {
            mClient.getParams().setParameter(HttpMethodParams.USER_AGENT,
                    OwnCloudClientManagerFactory.getNextcloudUserAgent());
        }
        mClient.setUseNextcloudUserAgent(useNextcloudUserAgent);

        return run(client);
    }
+1 −0
Original line number Diff line number Diff line
@@ -63,6 +63,7 @@ public class WebDavFileUtils {
        String stripString = client.getWebdavUri().getPath();
        if (isSearchOperation && username != null) {
            stripString = stripString.substring(0, stripString.lastIndexOf("/")) + "/dav/files/" + username;
            stripString = stripString.replaceAll(" ", "%20");
        }

        // loop to update every child
+3 −2
Original line number Diff line number Diff line
@@ -24,8 +24,6 @@

package com.owncloud.android.lib.resources.files;

import org.apache.jackrabbit.webdav.client.methods.MkColMethod;

import com.owncloud.android.lib.common.OwnCloudClient;
import com.owncloud.android.lib.common.network.WebdavUtils;
import com.owncloud.android.lib.common.operations.RemoteOperation;
@@ -34,6 +32,8 @@ import com.owncloud.android.lib.common.operations.RemoteOperationResult.ResultCo
import com.owncloud.android.lib.common.utils.Log_OC;
import com.owncloud.android.lib.resources.status.OwnCloudVersion;

import org.apache.jackrabbit.webdav.client.methods.MkColMethod;


/**
 * Remote operation performing the creation of a new folder in the ownCloud server.
@@ -99,6 +99,7 @@ public class CreateRemoteFolderOperation extends RemoteOperation {
        MkColMethod mkcol = null;
        try {
            mkcol = new MkColMethod(client.getWebdavUri() + WebdavUtils.encodePath(mRemotePath));
            client.setUseNextcloudUserAgent(true);
            client.executeMethod(mkcol, READ_TIMEOUT, CONNECTION_TIMEOUT);
            result = new RemoteOperationResult(mkcol.succeeded(), mkcol);
            Log_OC.d(TAG, "Create directory " + mRemotePath + ": " + result.getLogMessage());
+13 −10
Original line number Diff line number Diff line
@@ -97,14 +97,16 @@ public class ReadRemoteFolderOperation extends RemoteOperation {
                client.exhaustResponse(query.getResponseBodyAsStream());
                result = new RemoteOperationResult(false, query);
            }

        } catch (Exception e) {
            result = new RemoteOperationResult(e);


        } finally {
            if (query != null)
                query.releaseConnection();  // let the connection available for other methods

            if (result == null) {
                result = new RemoteOperationResult(new Exception("unknown error"));
                Log_OC.e(TAG, "Synchronized " + mRemotePath + ": failed");
            } else {
                if (result.isSuccess()) {
                    Log_OC.i(TAG, "Synchronized " + mRemotePath + ": " + result.getLogMessage());
                } else {
@@ -115,8 +117,9 @@ public class ReadRemoteFolderOperation extends RemoteOperation {
                        Log_OC.e(TAG, "Synchronized " + mRemotePath + ": " + result.getLogMessage());
                    }
                }

            }
        }
        
        return result;
    }