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
3 changes: 2 additions & 1 deletion src/android/CameraLauncher.java
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -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))) {
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;
Expand Down
2 changes: 1 addition & 1 deletion src/android/FileHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,6 @@ public static boolean isMediaDocument(Uri uri) {
* @return Whether the Uri authority is Google Photos.
*/
public static boolean isGooglePhotosUri(Uri uri) {
return "com.google.android.apps.photos.content".equals(uri.getAuthority());
return "com.google.android.apps.photos.content".equals(uri.getAuthority()) || "com.google.android.apps.photos.contentprovider".equals(uri.getAuthority());
}
}