From 5910c9f469e78cb5dde7b526136247602cd734d0 Mon Sep 17 00:00:00 2001 From: dev-12 Date: Thu, 19 Mar 2026 16:29:08 +0530 Subject: [PATCH] add support for deleted method with body http deleted request can contain body; skipping adding the body is causing api client to fail (i.e. Nextcloud password delete api need to send body with request) --- .../android/sso/DeleteMethodWithBody.java | 35 +++++++++++++++++++ .../android/sso/InputStreamBinder.java | 15 ++++++++ 2 files changed, 50 insertions(+) create mode 100644 app/src/main/java/com/nextcloud/android/sso/DeleteMethodWithBody.java diff --git a/app/src/main/java/com/nextcloud/android/sso/DeleteMethodWithBody.java b/app/src/main/java/com/nextcloud/android/sso/DeleteMethodWithBody.java new file mode 100644 index 000000000..069ab76cd --- /dev/null +++ b/app/src/main/java/com/nextcloud/android/sso/DeleteMethodWithBody.java @@ -0,0 +1,35 @@ +/* + * Copyright MURENA SAS 2026 + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.nextcloud.android.sso; + +import org.apache.commons.httpclient.methods.EntityEnclosingMethod; + +public class DeleteMethodWithBody extends EntityEnclosingMethod { + + public DeleteMethodWithBody() { + super(); + } + + public DeleteMethodWithBody(String uri) { + super(uri); + } + + @Override + public String getName() { + return "DELETE"; + } +} 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 2c8bad6e9..025dc7f9b 100644 --- a/app/src/main/java/com/nextcloud/android/sso/InputStreamBinder.java +++ b/app/src/main/java/com/nextcloud/android/sso/InputStreamBinder.java @@ -299,6 +299,21 @@ public class InputStreamBinder extends IInputStreamService.Stub { } break; + case "DELETE_PASSWORD": + method = new DeleteMethodWithBody(requestUrl); + if (requestBodyInputStream != null) { + RequestEntity requestEntity = new InputStreamRequestEntity(requestBodyInputStream); + ((DeleteMethodWithBody) method).setRequestEntity(requestEntity); + method = new DeleteMethodWithBody(requestUrl); + } else if (request.getRequestBody() != null) { + StringRequestEntity requestEntity = new StringRequestEntity( + request.getRequestBody(), + CONTENT_TYPE_APPLICATION_JSON, + CHARSET_UTF8); + ((DeleteMethodWithBody) method).setRequestEntity(requestEntity); + } + break; + case "DELETE": method = new DeleteMethod(requestUrl); break; -- GitLab