Skip to content
This repository has been archived by the owner on Jun 16, 2023. It is now read-only.

Commit

Permalink
fix: android base64 string format for consistency with ios (#1776)
Browse files Browse the repository at this point in the history
  • Loading branch information
mvayngrib authored and sibelius committed Sep 4, 2018
1 parent 652ea5f commit d4b4ee1
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ private static Bitmap toBitmap(byte[] data) {
}

public String toBase64(int jpegQualityPercent) {
return Base64.encodeToString(toJpeg(currentRepresentation, jpegQualityPercent), Base64.DEFAULT);
return Base64.encodeToString(toJpeg(currentRepresentation, jpegQualityPercent), Base64.NO_WRAP);
}

public void writeDataToFile(File file, ReadableMap options, int jpegQualityPercent) throws IOException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -434,7 +434,7 @@ private void releaseMediaRecorder() {
switch (mRecordingOptions.getInt("target")) {
case RCT_CAMERA_CAPTURE_TARGET_MEMORY:
byte[] encoded = convertFileToByteArray(mVideoFile);
response.putString("data", new String(encoded, Base64.DEFAULT));
response.putString("data", new String(encoded, Base64.NO_WRAP));
mRecordingPromise.resolve(response);
f.delete();
break;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ protected WritableMap doInBackground(Void... voids) {
if (mOptions.hasKey("fixOrientation") && mOptions.getBoolean("fixOrientation") && orientation != ExifInterface.ORIENTATION_UNDEFINED) {
mBitmap = rotateBitmap(mBitmap, getImageRotation(orientation));
}

if (mOptions.hasKey("width")) {
mBitmap = resizeBitmap(mBitmap, mOptions.getInt("width"));
}
Expand Down Expand Up @@ -125,7 +125,7 @@ protected WritableMap doInBackground(Void... voids) {

// Write base64-encoded image to the response if requested
if (mOptions.hasKey("base64") && mOptions.getBoolean("base64")) {
response.putString("base64", Base64.encodeToString(imageStream.toByteArray(), Base64.DEFAULT));
response.putString("base64", Base64.encodeToString(imageStream.toByteArray(), Base64.NO_WRAP));
}

// Cleanup
Expand Down

0 comments on commit d4b4ee1

Please sign in to comment.