Skip to content
This repository has been archived by the owner on Mar 19, 2024. It is now read-only.

Commit

Permalink
Return okhttp response instead of dav4android one within propfind ope…
Browse files Browse the repository at this point in the history
…rations
  • Loading branch information
davigonz committed Jul 18, 2018
1 parent 778abb0 commit f890d8f
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 13 deletions.
2 changes: 0 additions & 2 deletions src/com/owncloud/android/lib/common/OwnCloudClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -175,8 +175,6 @@ private int executeRedirectedHttpMethod (HttpBaseMethod method) throws Exception
return status;
}



public RedirectionPath followRedirection(HttpBaseMethod method) throws Exception {
int redirectionsCount = 0;
int status = method.getStatusCode();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,13 @@

package com.owncloud.android.lib.common.http.methods.webdav;

import com.owncloud.android.lib.common.http.HttpClient;
import com.owncloud.android.lib.common.http.methods.HttpBaseMethod;

import java.net.URL;
import java.util.concurrent.TimeUnit;

import at.bitfire.dav4android.Constants;
import at.bitfire.dav4android.DavOCResource;
import at.bitfire.dav4android.DavResource;
import at.bitfire.dav4android.exception.RedirectException;
import okhttp3.HttpUrl;

Expand Down Expand Up @@ -61,8 +59,8 @@ public void abort() {
@Override
public int execute() throws Exception {
try {
return onExecute();
} catch(RedirectException e) {
return onExecute();
} catch (RedirectException e) {
return getStatusCode();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import java.net.URL;
import java.util.ArrayList;
import java.util.List;

import at.bitfire.dav4android.Property;
import at.bitfire.dav4android.Response;
import at.bitfire.dav4android.exception.DavException;
Expand Down Expand Up @@ -73,16 +74,14 @@ public int onExecute() throws IOException, DavException {
}

return Unit.INSTANCE;
}, response -> {
mResponse = response;
return Unit.INSTANCE;
});
}, response -> Unit.INSTANCE);
} catch (UnauthorizedException davException) {
// Do nothing, we will use the 401 code to handle the situation
return davException.getCode();
}

return super.getStatusCode();
mResponse = mDavResource.getResponse();

return getStatusCode();
}

public int getDepth() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ public ExistenceCheckRemoteOperation(String remotePath, boolean successIfAbsent)
@Override
protected RemoteOperationResult run(OwnCloudClient client) {


try {
client.setFollowRedirects(true);
PropfindMethod propfindMethod = new PropfindMethod(
Expand Down

0 comments on commit f890d8f

Please sign in to comment.