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

FileEntry.toURL() "cdvfile://localhost/persistent/file://"

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Not A Problem
    • 3.4.0
    • None
    • cordova-plugin-file
    • Android 4.4 using Genymotion emulator

    Description

      When I run something like this:

      window.resolveLocalFileSystemURL('file:///storage/emulated/0/DCIM/Camera/1394726081689.jpg', function(entry) {
          console.log(entry.fullPath);
          console.log(entry.toURL());
          entry.file(fileSuccess, fail);
      });
      

      The logcat shows this result:

      I/chromium( 3022): [INFO:CONSOLE(28)] "file:///storage/emulated/0/DCIM/Camera/1394726081689.jpg", source: file:///android_asset/www/js/pdf.js (28)
      I/chromium( 3022): [INFO:CONSOLE(29)] "cdvfile://localhost/temporary/file://storage/emulated/0/DCIM/Camera/1394726081689.jpg", source: file:///android_asset/www/js/pdf.js (29)
      W/System.err( 2928): java.io.FileNotFoundException: File: cdvfile://localhost/persistent/file://storage/emulated/0/DCIM/Camera/1394726081689.jpg does not exist.
      W/System.err( 2928):    at org.apache.cordova.file.FileUtils.getFileMetadata(FileUtils.java:953)
      W/System.err( 2928):    at org.apache.cordova.file.FileUtils.access$400(FileUtils.java:53)
      W/System.err( 2928):    at org.apache.cordova.file.FileUtils$14.run(FileUtils.java:220)
      W/System.err( 2928):    at org.apache.cordova.file.FileUtils$23.run(FileUtils.java:325)
      W/System.err( 2928):    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
      W/System.err( 2928):    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
      W/System.err( 2928):    at java.lang.Thread.run(Thread.java:841)
      

      As you can see the second console.log has the cdvfile protocol with the file protocol appended to the end. I'm sure this is causing the following error. Seems that the same code runs perfectly on iOS returning the correct URLs:

      [Log] /cdv_photo_001.jpg
      [Log] cdvfile://localhost/temporary/cdv_photo_001.jpg
      

      Attachments

        Activity

          People

            iclelland Ian Clelland
            davidnormo David Normington
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: