diff --git a/owncloudComLibrary/src/main/java/com/owncloud/android/lib/common/http/methods/webdav/DavMethod.java b/owncloudComLibrary/src/main/java/com/owncloud/android/lib/common/http/methods/webdav/DavMethod.java index 2e9dee81..4255e1a6 100644 --- a/owncloudComLibrary/src/main/java/com/owncloud/android/lib/common/http/methods/webdav/DavMethod.java +++ b/owncloudComLibrary/src/main/java/com/owncloud/android/lib/common/http/methods/webdav/DavMethod.java @@ -78,14 +78,18 @@ public abstract class DavMethod extends HttpBaseMethod { .build(); } else if (mResponse != null) { - ResponseBody responseBody = ResponseBody.create( - mResponse.body().contentType(), - httpException.getResponseBody() - ); + // The check below should be included in okhttp library, method ResponseBody.create( + // TODO check most recent versions of okhttp to see if this is already fixed and try to update if so + if (mResponse.body().contentType() != null) { + ResponseBody responseBody = ResponseBody.create( + mResponse.body().contentType(), + httpException.getResponseBody() + ); - mResponse = mResponse.newBuilder() - .body(responseBody) - .build(); + mResponse = mResponse.newBuilder() + .body(responseBody) + .build(); + } } return httpException.getCode(); diff --git a/owncloudComLibrary/src/main/java/com/owncloud/android/lib/common/operations/RemoteOperationResult.java b/owncloudComLibrary/src/main/java/com/owncloud/android/lib/common/operations/RemoteOperationResult.java index 881aa0d2..715ed32c 100644 --- a/owncloudComLibrary/src/main/java/com/owncloud/android/lib/common/operations/RemoteOperationResult.java +++ b/owncloudComLibrary/src/main/java/com/owncloud/android/lib/common/operations/RemoteOperationResult.java @@ -66,7 +66,7 @@ public class RemoteOperationResult private Exception mException = null; private ResultCode mCode = ResultCode.UNKNOWN_ERROR; private String mRedirectedLocation; - private String mAuthenticate; + private List mAuthenticate = new ArrayList<>(); private String mLastPermanentLocation = null; private T mData = null; @@ -253,7 +253,9 @@ public class RemoteOperationResult continue; } if ("www-authenticate".equals(header.getKey().toLowerCase())) { - mAuthenticate = header.getValue().get(0).toLowerCase(); + for (String value: header.getValue()) { + mAuthenticate.add(value.toLowerCase()); + } } } } @@ -494,7 +496,7 @@ public class RemoteOperationResult return (mRedirectedLocation != null && !(mRedirectedLocation.toLowerCase().startsWith("https://"))); } - public String getAuthenticateHeaders() { + public List getAuthenticateHeaders() { return mAuthenticate; }