mirror of
				https://github.com/owncloud/android-library.git
				synced 2025-10-31 10:27:45 +00:00 
			
		
		
		
	Fix crash when response body is empty and solve issue when retrieving auth methods
This commit is contained in:
		
							parent
							
								
									64bfd6a7f7
								
							
						
					
					
						commit
						f20d2554bf
					
				| @ -78,6 +78,9 @@ public abstract class DavMethod extends HttpBaseMethod { | ||||
|                         .build(); | ||||
| 
 | ||||
|             } else if (mResponse != null) { | ||||
|                 // 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() | ||||
| @ -87,6 +90,7 @@ public abstract class DavMethod extends HttpBaseMethod { | ||||
|                             .body(responseBody) | ||||
|                             .build(); | ||||
|                 } | ||||
|             } | ||||
| 
 | ||||
|             return httpException.getCode(); | ||||
|         } | ||||
|  | ||||
| @ -66,7 +66,7 @@ public class RemoteOperationResult<T> | ||||
|     private Exception mException = null; | ||||
|     private ResultCode mCode = ResultCode.UNKNOWN_ERROR; | ||||
|     private String mRedirectedLocation; | ||||
|     private String mAuthenticate; | ||||
|     private List<String> mAuthenticate = new ArrayList<>(); | ||||
|     private String mLastPermanentLocation = null; | ||||
|     private T mData = null; | ||||
| 
 | ||||
| @ -253,7 +253,9 @@ public class RemoteOperationResult<T> | ||||
|                     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<T> | ||||
|         return (mRedirectedLocation != null && !(mRedirectedLocation.toLowerCase().startsWith("https://"))); | ||||
|     } | ||||
| 
 | ||||
|     public String getAuthenticateHeaders() { | ||||
|     public List<String> getAuthenticateHeaders() { | ||||
|         return mAuthenticate; | ||||
|     } | ||||
| 
 | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user