[jira] [Commented] (CB-13245) Filereader.readAsText fails on Android with long text files when

2018-05-29 Thread Joel Henry (JIRA)


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

Joel Henry commented on CB-13245:
-

any update on this fix? i'm experiencing the same problem

> Filereader.readAsText fails on Android with long text files when
> 
>
> Key: CB-13245
> URL: https://issues.apache.org/jira/browse/CB-13245
> Project: Apache Cordova
>  Issue Type: Bug
>  Components: cordova-plugin-file
>Affects Versions: Master
> Environment: Android 7.1.1
>Reporter: Daniel Behnen
>Priority: Major
>
> 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.



--
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



[jira] [Created] (CB-14110) Cordova Plugin File not reading large json files correctly - android

2018-05-29 Thread Joel Henry (JIRA)
Joel Henry created CB-14110:
---

 Summary: Cordova Plugin File not reading large json files 
correctly - android
 Key: CB-14110
 URL: https://issues.apache.org/jira/browse/CB-14110
 Project: Apache Cordova
  Issue Type: Bug
  Components: cordova-plugin-file
Affects Versions: 6.0.1
 Environment: cordova version: 7.1.0

cordova-android: 7.1.0

cordova-ios: 7.1.0
Reporter: Joel Henry


When reading a large json file (293kb), readAsText renders string incorrectly, 
adding duplicate text after the file's text ends and breaking json structure. 
JSON.parse the text fails due to this. It hangs and fails.
{code:java}
const root = `${this.window.cordova.file.applicationDirectory}www/assets/`;

this.window.resolveLocalFileSystemURL(this.root + fileName,

(fileEntry: FileEntry) => {

fileEntry.file(file => {

const reader = new (this.window.cordova).FileReader();

reader.onloadend = function () {
console.log(JSON.parse(this.result));
};

reader.readAsText(file);
});
});
{code}



--
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