From de8b50dc1d87510c5f19d04f30b6be12b51d8482 Mon Sep 17 00:00:00 2001 From: jcesarmobile Date: Tue, 9 Jul 2024 19:27:24 +0200 Subject: [PATCH] fix(android): send FormData on older devices (#7519) --- .../getcapacitor/plugin/util/CapacitorHttpUrlConnection.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/android/capacitor/src/main/java/com/getcapacitor/plugin/util/CapacitorHttpUrlConnection.java b/android/capacitor/src/main/java/com/getcapacitor/plugin/util/CapacitorHttpUrlConnection.java index a8330feba..441153749 100644 --- a/android/capacitor/src/main/java/com/getcapacitor/plugin/util/CapacitorHttpUrlConnection.java +++ b/android/capacitor/src/main/java/com/getcapacitor/plugin/util/CapacitorHttpUrlConnection.java @@ -289,6 +289,8 @@ private void writeFormDataRequestBody(String contentType, JSArray entries) throw if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { os.write(Base64.getDecoder().decode(value)); + } else { + os.write(android.util.Base64.decode(value, android.util.Base64.DEFAULT)); } os.writeBytes(lineEnd);