Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CB-13307: (Android) Fixed issue when unable to load image with mime t… #286

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Prev Previous commit
Next Next commit
Added static string to reference wildcard mime type
DavidBriglio committed Oct 1, 2018
commit 83d8d0537ba7d582e2be1e9f3704a380149a29d5
3 changes: 2 additions & 1 deletion src/android/CameraLauncher.java
Original file line number Diff line number Diff line change
@@ -91,6 +91,7 @@ public class CameraLauncher extends CordovaPlugin implements MediaScannerConnect
private static final String PNG_EXTENSION = ".png";
private static final String PNG_MIME_TYPE = "image/png";
private static final String JPEG_MIME_TYPE = "image/jpeg";
private static final String WILD_MIME_TYPE = "image/*";
private static final String GET_PICTURE = "Get Picture";
private static final String GET_VIDEO = "Get Video";
private static final String GET_All = "Get All";
@@ -710,7 +711,7 @@ private void processResultFromGallery(int destType, Intent intent) {
this.callbackContext.success(uriString);
} else {
// If we don't have a valid image so quit.
if (!(JPEG_MIME_TYPE.equalsIgnoreCase(mimeType) || PNG_MIME_TYPE.equalsIgnoreCase(mimeType) || "image/*".equalsIgnoreCase(mimeType))) {
if (!(JPEG_MIME_TYPE.equalsIgnoreCase(mimeType) || PNG_MIME_TYPE.equalsIgnoreCase(mimeType) || WILD_MIME_TYPE.equalsIgnoreCase(mimeType))) {
LOG.d(LOG_TAG, "I either have a null image path or bitmap");
this.failPicture("Unable to retrieve path to picture!");
return;