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

Filereader.readAsText fails on Android with long text files when

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • Master
    • None
    • cordova-plugin-file
    • None
    • Android 7.1.1

    Description

      When reader.readAsText is called with an URI pointing to a local asset with a size greater than READ_CHUNK_SIZE = 256 * 1024, loading produces corrupt data.

      The behaviour is caused by a negative length returned by CordovaResourceApi.openForRead() when the URI is a URI_TYPE_ASSET. Given the negative length, Filesystem.readFileAtURL() returns the whole file instead of the desired part and FileReader.readSuccessCallback() does not check the returned buffer size. Hence, the following chunks are attated to the buffer regardless of whether the file was already completely read.

      Attachments

        Activity

          People

            Unassigned Unassigned
            DanielBehnen Daniel Behnen
            Votes:
            2 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:

              Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0h
                0h
                Logged:
                Time Spent - 10m
                10m