From 2500a692a7a68ad76f1f3eec525640ecb9354268 Mon Sep 17 00:00:00 2001 From: alperozturk Date: Tue, 28 Oct 2025 10:21:05 +0100 Subject: [PATCH] revert input stream changes Signed-off-by: alperozturk --- .../android/sso/InputStreamBinder.java | 31 ++++++++----------- 1 file changed, 13 insertions(+), 18 deletions(-) diff --git a/app/src/main/java/com/nextcloud/android/sso/InputStreamBinder.java b/app/src/main/java/com/nextcloud/android/sso/InputStreamBinder.java index ffdb39337985..31e061b5778c 100644 --- a/app/src/main/java/com/nextcloud/android/sso/InputStreamBinder.java +++ b/app/src/main/java/com/nextcloud/android/sso/InputStreamBinder.java @@ -422,29 +422,24 @@ private Response processRequestV2(final NextcloudRequest request, final InputStr client.setFollowRedirects(request.isFollowRedirects()); int status = client.executeMethod(method); - // handle “Not Modified” responses - if (status == 304) { - Log_OC.i(TAG, "Received status " + status + " not modified"); - method.releaseConnection(); - return new Response(); - } - + // Check if status code is 2xx --> https://en.wikipedia.org/wiki/List_of_HTTP_status_codes#2xx_Success if (status >= HTTP_STATUS_CODE_OK && status < HTTP_STATUS_CODE_MULTIPLE_CHOICES) { return new Response(method); - } + } else { + InputStream inputStream = method.getResponseBodyAsStream(); + String total = "No response body"; - InputStream inputStream = method.getResponseBodyAsStream(); - String total = "No response body"; + // If response body is available + if (inputStream != null) { + total = inputStreamToString(inputStream); + Log_OC.e(TAG, total); + } - if (inputStream != null) { - total = inputStreamToString(inputStream); - Log_OC.e(TAG, total); + method.releaseConnection(); + throw new IllegalStateException(EXCEPTION_HTTP_REQUEST_FAILED, + new IllegalStateException(String.valueOf(status), + new IllegalStateException(total))); } - - method.releaseConnection(); - throw new IllegalStateException(EXCEPTION_HTTP_REQUEST_FAILED, - new IllegalStateException(String.valueOf(status), - new IllegalStateException(total))); } private boolean isValid(NextcloudRequest request) {