From e25b11668ce2fb4072074152144ed1732680206e Mon Sep 17 00:00:00 2001 From: jcesarmobile Date: Tue, 18 Jun 2024 20:11:55 +0200 Subject: [PATCH] fix(android): send FormData on older devices --- .../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 6f04cc30e..a949ee889 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);