[ 
https://issues.apache.org/jira/browse/CB-13307?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16633142#comment-16633142
 ] 

ASF GitHub Bot commented on CB-13307:
-------------------------------------

janpio closed pull request #286: CB-13307: (Android) Fixed issue when unable to 
load image with mime t…
URL: https://github.com/apache/cordova-plugin-camera/pull/286
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/README.md b/README.md
index 901f5d86..662d998d 100644
--- a/README.md
+++ b/README.md
@@ -21,9 +21,9 @@ description: Take pictures with the device camera.
 #         under the License.
 -->
 
-|AppVeyor|Travis CI|
-|:-:|:-:|
-|[![Build 
status](https://ci.appveyor.com/api/projects/status/github/apache/cordova-plugin-camera?branch=master)](https://ci.appveyor.com/project/ApacheSoftwareFoundation/cordova-plugin-camera)|[![Build
 
Status](https://travis-ci.org/apache/cordova-plugin-camera.svg?branch=master)](https://travis-ci.org/apache/cordova-plugin-camera)|
+|Android|iOS| Windows 8.1 Store | Windows 8.1 Phone | Windows 10 Store | 
Travis CI |
+|:-:|:-:|:-:|:-:|:-:|:-:|
+|[![Build 
Status](http://cordova-ci.cloudapp.net:8080/buildStatus/icon?job=cordova-periodic-build/PLATFORM=android,PLUGIN=cordova-plugin-camera)](http://cordova-ci.cloudapp.net:8080/job/cordova-periodic-build/PLATFORM=android,PLUGIN=cordova-plugin-camera/)|[![Build
 
Status](http://cordova-ci.cloudapp.net:8080/buildStatus/icon?job=cordova-periodic-build/PLATFORM=ios,PLUGIN=cordova-plugin-camera)](http://cordova-ci.cloudapp.net:8080/job/cordova-periodic-build/PLATFORM=ios,PLUGIN=cordova-plugin-camera/)|[![Build
 
Status](http://cordova-ci.cloudapp.net:8080/buildStatus/icon?job=cordova-periodic-build/PLATFORM=windows-8.1-store,PLUGIN=cordova-plugin-camera)](http://cordova-ci.cloudapp.net:8080/job/cordova-periodic-build/PLATFORM=windows-8.1-store,PLUGIN=cordova-plugin-camera/)|[![Build
 
Status](http://cordova-ci.cloudapp.net:8080/buildStatus/icon?job=cordova-periodic-build/PLATFORM=windows-8.1-phone,PLUGIN=cordova-plugin-camera)](http://cordova-ci.cloudapp.net:8080/job/cordova-periodic-build/PLATFORM=windows-8.1-phone,PLUGIN=cordova-plugin-camera/)|[![Build
 
Status](http://cordova-ci.cloudapp.net:8080/buildStatus/icon?job=cordova-periodic-build/PLATFORM=windows-10-store,PLUGIN=cordova-plugin-camera)](http://cordova-ci.cloudapp.net:8080/job/cordova-periodic-build/PLATFORM=windows-10-store,PLUGIN=cordova-plugin-camera/)|[![Build
 
Status](https://travis-ci.org/apache/cordova-plugin-camera.svg?branch=master)](https://travis-ci.org/apache/cordova-plugin-camera)
 
 # cordova-plugin-camera
 
@@ -53,7 +53,7 @@ It is also possible to install via repo url directly ( 
unstable )
 
 ## How to Contribute
 
-Contributors are welcome! And we need your contributions to keep the project 
moving forward. You can [report 
bugs](https://issues.apache.org/jira/issues/?jql=project%20%3D%20CB%20AND%20status%20in%20(Open%2C%20%22In%20Progress%22%2C%20Reopened)%20AND%20resolution%20%3D%20Unresolved%20AND%20component%20%3D%20%22cordova-plugin-camera%22%20ORDER%20BY%20priority%20DESC%2C%20summary%20ASC%2C%20updatedDate%20DESC),
 improve the documentation, or [contribute 
code](https://github.com/apache/cordova-plugin-camera/pulls).
+Contributors are welcome! And we need your contributions to keep the project 
moving forward. You can [report 
bugs](https://issues.apache.org/jira/issues/?jql=project%20%3D%20CB%20AND%20status%20in%20(Open%2C%20%22In%20Progress%22%2C%20Reopened)%20AND%20resolution%20%3D%20Unresolved%20AND%20component%20%3D%20%22Plugin%20Camera%22%20ORDER%20BY%20priority%20DESC%2C%20summary%20ASC%2C%20updatedDate%20DESC),
 improve the documentation, or [contribute 
code](https://github.com/apache/cordova-plugin-camera/pulls).
 
 There is a specific [contributor 
workflow](http://wiki.apache.org/cordova/ContributorWorkflow) we recommend. 
Start reading there. More information is available on [our 
wiki](http://wiki.apache.org/cordova).
 
diff --git a/src/android/CameraLauncher.java b/src/android/CameraLauncher.java
index 03210828..757723d4 100644
--- a/src/android/CameraLauncher.java
+++ b/src/android/CameraLauncher.java
@@ -710,7 +710,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) || 
"image/*".equalsIgnoreCase(mimeType))) {
                     LOG.d(LOG_TAG, "I either have a null image path or 
bitmap");
                     this.failPicture("Unable to retrieve path to picture!");
                     return;
diff --git a/src/android/FileHelper.java b/src/android/FileHelper.java
index edf16578..5aa396c0 100644
--- a/src/android/FileHelper.java
+++ b/src/android/FileHelper.java
@@ -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());
     }
 }


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> Accessing Google Photos on Pixel from cordova-plugin-camera
> -----------------------------------------------------------
>
>                 Key: CB-13307
>                 URL: https://issues.apache.org/jira/browse/CB-13307
>             Project: Apache Cordova
>          Issue Type: Bug
>          Components: cordova-plugin-camera
>            Reporter: David Briglio
>            Priority: Major
>
> Currently when trying to access some photos from Google Photos, it fails to 
> load. Android 8.0 on Google Pixel, cordova version 6.5.0, 
> cordova-plugin-camera version 2.4.1.
> Causes:
> 1) Only mimetypes "image/jpeg" and "image/png" are accepted, all other types 
> are considered an invalid image. The mimetype of the image I am loading gets 
> set to "image/*".
> 2) In FileHelper.java: when hitting the isGooglePhotosUri method, the uri 
> authority is compared against "com.google.android.apps.photos.content", where 
> the actual is "com.google.android.apps.photos.contentprovider". This causes 
> the logic to dismiss the image as not from Google Photos.
> After applying fixes for these two areas, I am able to successfully load all 
> of my images.
> Merge request [here|https://github.com/apache/cordova-plugin-camera/pull/286].



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org
For additional commands, e-mail: issues-h...@cordova.apache.org

Reply via email to