From 8e15a3e334554d449c00736043b334bfc1d5eb2a Mon Sep 17 00:00:00 2001 From: jcesarmobile Date: Tue, 9 Jul 2024 19:39:15 +0200 Subject: [PATCH] fix(android): send FormData on older devices (#7519) (#7557) --- .../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 06f52c334..cc784de79 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);