apache / cordova-plugin-camera

Apache Cordova Plugin camera
https://cordova.apache.org/
Apache License 2.0
966 stars 1.55k forks source link

Plugin crashes when using PHOTOLIBRARY on Android #548

Closed jfoclpf closed 3 years ago

jfoclpf commented 4 years ago

Bug Report

Problem

When obtaining some pictures on the phone file system using PHOTOLIBRARY, particularly image files stored in /Phone/Download, the app crashes. Normally it does work, but it seems in some folders the app crashes

What is expected to happen?

The function camera.getPicture(successCallback, errorCallback, options) should run the function successCallback

What does actually happen?

When the function camera.getPicture(successCallback, errorCallback, options) is called, wherein options has sourceType:Camera.PictureSourceType.PHOTOLIBRARY, the app crashes when I select certain files

Information

Command or Code

    var options = {
      quality: 50,
      destinationType: Camera.DestinationType.FILE_URI,
      sourceType: Camera.PictureSourceType.PHOTOLIBRARY,
      encodingType: Camera.EncodingType.JPEG,
      mediaType: Camera.MediaType.PICTURE,
      allowEdit: false,
      correctOrientation: true // Corrects Android orientation quirks
    }

    console.log('starting navigator.camera.getPicture') // this is shown
    navigator.camera.getPicture(function (result) {
      console.log('cameraSuccess init') // this is never shown, it crashes before
      cameraSuccess(result)
    },
    function cameraError (error) {
      console.debug('error getting photo: ' + error, 'app') // this is not shown either, the app just crashes
    }, options)

Screenshots

drawing drawing

Environment, Platform, Device

Ubuntu, Android, Samsung Galaxy A5

Version information

Cordova: 9.0.0 (cordova-lib@9.0.1)

Plugins

cordova-pdf-generator 2.0.8 "PDFGenerator"
cordova-plugin-camera 4.0.3 "Camera"
cordova-plugin-compat 1.2.0 "Compat"
cordova-plugin-device 2.0.3 "Device"
cordova-plugin-email-composer 0.8.15 "EmailComposer"
cordova-plugin-file 6.0.1 "File"
cordova-plugin-file-transfer 1.7.1 "File Transfer"
cordova-plugin-geolocation 2.4.3 "Geolocation"
cordova-plugin-inappbrowser 3.2.0 "InAppBrowser"
cordova-plugin-mobile-ocr 3.1.1 "Textocr"
cordova-plugin-network-information 2.0.2 "Network Information"
cordova-plugin-screen-orientation 3.0.2 "Screen Orientation"
cordova-plugin-simple-image-resizer 0.1.1 "Image Resizer"
cordova-plugin-statusbar 2.4.3 "StatusBar"
cordova-plugin-whitelist 1.3.4 "Whitelist"
es6-promise-plugin 4.2.2 "Promise"
info.protonet.imageresizer 0.1.1 "Image Resizer"

Java

java version "1.8.0_131"
Java(TM) SE Runtime Environment (build 1.8.0_131-b11)
Java HotSpot(TM) 64-Bit Server VM (build 25.131-b11, mixed mode)

adb

Android Debug Bridge version 1.0.41
Version 29.0.1-5644136
Installed as /usr/local/android-sdk/platform-tools/adb

Checklist

jfoclpf commented 4 years ago

What is very strange is that, when I get exactly the same picture but obtained through folder "Recent" in Android file Explorer opened by this plugin, the app does not crash.