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

Unverified Commit ede809b0 authored by tobiasKaminsky's avatar tobiasKaminsky
Browse files

do not fail if permission is empty/null

correctly set user agent everywhere
parent 591eeb21
Loading
Loading
Loading
Loading
+14 −10
Original line number Diff line number Diff line
@@ -71,6 +71,8 @@ public class OwnCloudClient extends HttpClient {

    private OwnCloudVersion mVersion = null;
    
    private boolean mUseNextcloudUserAgent = false;
    
    /**
     * Constructor
     */
@@ -81,6 +83,7 @@ public class OwnCloudClient extends HttpClient {
        	throw new IllegalArgumentException("Parameter 'baseUri' cannot be NULL");
        }
        mBaseUri = baseUri;
        mUseNextcloudUserAgent = useNextcloudUserAgent;
        
        mInstanceNumber = sIntanceCounter++;
        Log_OC.d(TAG + " #" + mInstanceNumber, "Creating OwnCloudClient");
@@ -94,15 +97,10 @@ public class OwnCloudClient extends HttpClient {
        }
        
        getParams().setParameter(HttpMethodParams.USER_AGENT, userAgent);
        getParams().setParameter(
        		PARAM_PROTOCOL_VERSION,
        		HttpVersion.HTTP_1_1);
        
        getParams().setCookiePolicy(
        		CookiePolicy.IGNORE_COOKIES);
        getParams().setParameter(
        		PARAM_SINGLE_COOKIE_HEADER, 			// to avoid problems with some web servers
        		PARAM_SINGLE_COOKIE_HEADER_VALUE);
        getParams().setParameter(PARAM_PROTOCOL_VERSION, HttpVersion.HTTP_1_1);
        getParams().setCookiePolicy(CookiePolicy.IGNORE_COOKIES);
        // to avoid problems with some web servers
        getParams().setParameter(PARAM_SINGLE_COOKIE_HEADER, PARAM_SINGLE_COOKIE_HEADER_VALUE); 
        
        applyProxySettings();
        
@@ -215,7 +213,13 @@ public class OwnCloudClient extends HttpClient {
        try {
            // Update User Agent
            HttpParams params = method.getParams();
            String userAgent = OwnCloudClientManagerFactory.getUserAgent();

            String userAgent;
            if (mUseNextcloudUserAgent) {
                userAgent = OwnCloudClientManagerFactory.getUserAgent();
            } else {
                userAgent = OwnCloudClientManagerFactory.getNextcloudUserAgent();
            }
            params.setParameter(HttpMethodParams.USER_AGENT, userAgent);

            Log_OC.d(TAG + " #" + mInstanceNumber, "REQUEST " +
+1 −1
Original line number Diff line number Diff line
@@ -181,7 +181,7 @@ public class WebdavEntry {
            prop = propSet.get(
            		EXTENDED_PROPERTY_NAME_PERMISSIONS, Namespace.getNamespace(NAMESPACE_OC)
    		);
            if (prop != null) {
            if (prop != null && prop.getValue() != null) {
                mPermissions = prop.getValue().toString();
            }