From 4e2720a60dcafc60df25e6a4e29e914f185dacaa Mon Sep 17 00:00:00 2001 From: jcesarmobile Date: Wed, 24 Jul 2019 14:13:40 +0200 Subject: [PATCH] fix(android): remove new line characters from camera base64 results --- .../src/main/java/com/getcapacitor/plugin/Camera.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/android/capacitor/src/main/java/com/getcapacitor/plugin/Camera.java b/android/capacitor/src/main/java/com/getcapacitor/plugin/Camera.java index 07a3c14f99..4dc928b4c1 100644 --- a/android/capacitor/src/main/java/com/getcapacitor/plugin/Camera.java +++ b/android/capacitor/src/main/java/com/getcapacitor/plugin/Camera.java @@ -406,7 +406,7 @@ private Bitmap replaceBitmap(Bitmap bitmap, final Bitmap newBitmap) { private void returnDataUrl(PluginCall call, ExifWrapper exif, ByteArrayOutputStream bitmapOutputStream) { byte[] byteArray = bitmapOutputStream.toByteArray(); - String encoded = Base64.encodeToString(byteArray, Base64.DEFAULT); + String encoded = Base64.encodeToString(byteArray, Base64.NO_WRAP); JSObject data = new JSObject(); data.put("dataUrl", "data:image/jpeg;base64," + encoded); @@ -416,7 +416,7 @@ private void returnDataUrl(PluginCall call, ExifWrapper exif, ByteArrayOutputStr private void returnBase64(PluginCall call, ExifWrapper exif, ByteArrayOutputStream bitmapOutputStream) { byte[] byteArray = bitmapOutputStream.toByteArray(); - String encoded = Base64.encodeToString(byteArray, Base64.DEFAULT); + String encoded = Base64.encodeToString(byteArray, Base64.NO_WRAP); JSObject data = new JSObject(); data.put("base64String", encoded);