Uploaded image for project: 'Apache Cordova'
  1. Apache Cordova
  2. CB-14097

Camera plugin crashes using getPicture on some files

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Critical
    • Resolution: Fixed
    • Affects Version/s: Master
    • Fix Version/s: Master
    • Component/s: cordova-plugin-camera
    • Labels:
      None
    • Environment:

      At least tested on:

      Cordova 7.1.0
      Camera 4.0.3

      But the code is the same in master branch.

      Description

      My app uses navigator.camera.getPicture to select files from a library.

      After selecting some files, the app crashes. Some files go well and it doesn't seem to happen on all devices.

      The crash happens in the FileHelper.java file and it the exception is:

      java.lang.NumberFormatException: For input string: "raw:/storage/emulated/0/Download/filename.PDF"

      It seems to be caused the way files are saved on the device. The urls of the files are different. When resaving the file, the URL can be as expected.

      Expected URL:

      content://com.android.providers.downloads.documents/document/1111

      Error URL:

      content://com.android.providers.downloads.documents/document/raw%3A%2Fstorage%2Femulated%2F0%2FDownload%2Ffilename.pdf

      The fix is the same as: https://github.com/severianremi/uCrop/commit/9e2bb067631ac3bd3817c0fb55c51db3d61edfe0

       

        Attachments

        1. logcat.txt
          14 kB
          B. van Mensvoort

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                bvmensvoort B. van Mensvoort
              • Votes:
                0 Vote for this issue
                Watchers:
                5 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: