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

2018-10-01 Thread ASF GitHub Bot (JIRA)


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

ASF GitHub Bot commented on CB-13245:
-

janpio commented on issue #217: CB-13245: (android) Fix bug caused by negative 
length reported for an asset
URL: 
https://github.com/apache/cordova-plugin-file/pull/217#issuecomment-425912429
 
 
   Hey, I just fixed the problem that caused Android tests to fail in `master`. 
Could you rebase this PR please? This should get rid of the Android failures 
and possibly fix all test failures for this PR.


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> 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] [Commented] (CB-13245) Filereader.readAsText fails on Android with long text files when

2018-07-12 Thread ASF GitHub Bot (JIRA)


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

ASF GitHub Bot commented on CB-13245:
-

AnthonyWard commented on issue #217: CB-13245: (android) Fix bug caused by 
negative length reported for an asset
URL: 
https://github.com/apache/cordova-plugin-file/pull/217#issuecomment-404457427
 
 
   This should be resolved now in version 7.1.1 of cordova-androd
   
   CB-13923 (android) fix -1 length for compressed files
   
   https://github.com/apache/cordova-android/blob/7.1.x/RELEASENOTES.md


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> 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] [Commented] (CB-13245) Filereader.readAsText fails on Android with long text files when

2018-06-11 Thread Anthony Ward (JIRA)


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

Anthony Ward commented on CB-13245:
---

I proposed a fix upstream in cordova-android that has been merged, but not yet 
released. This should solve the problem once the next release goes out.

> 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] [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=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] [Commented] (CB-13245) Filereader.readAsText fails on Android with long text files when

2018-05-29 Thread ASF GitHub Bot (JIRA)


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

ASF GitHub Bot commented on CB-13245:
-

oliverjanik commented on issue #217: CB-13245: (android) Fix bug caused by 
negative length reported for an asset
URL: 
https://github.com/apache/cordova-plugin-file/pull/217#issuecomment-393013245
 
 
   @infil00p  Is there an issue reported in Cordova? Can we get the ball 
rolling on this?
   
   It is absolutely unacceptable that such trivial bug exists for such a common 
functionality on a mature platform such as cordova.


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> 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] [Commented] (CB-13245) Filereader.readAsText fails on Android with long text files when

2018-03-06 Thread ASF GitHub Bot (JIRA)

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

ASF GitHub Bot commented on CB-13245:
-

infil00p commented on issue #217: CB-13245: (android) Fix bug caused by 
negative length reported for an asset
URL: 
https://github.com/apache/cordova-plugin-file/pull/217#issuecomment-370883325
 
 
   This should be fixed in Cordova, not in File.


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> 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] [Commented] (CB-13245) Filereader.readAsText fails on Android with long text files when

2018-02-26 Thread ASF GitHub Bot (JIRA)

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

ASF GitHub Bot commented on CB-13245:
-

AnthonyWard commented on issue #217: CB-13245: (android) Fix bug caused by 
negative length reported for an asset
URL: 
https://github.com/apache/cordova-plugin-file/pull/217#issuecomment-368679789
 
 
   This tripped me up the past few days. I also set up an app to demo this bug:
   
   https://github.com/AnthonyWard/cordova-file-plugin-bug
   
   One line of code it seems can fix it more "upstream" than this, but I don't 
know if it's a good idea:
   
   `cordova-android` -> `CordovaResourceApi.java` -> `OpenForReadResult` there 
is one path (in the `catch`) that leaves the length as -1 causing the defect
   
   ```java
   case URI_TYPE_ASSET: {
   String assetPath = uri.getPath().substring(15);
   AssetFileDescriptor assetFd = null;
   InputStream inputStream;
   long length = -1;
   try {
   assetFd = assetManager.openFd(assetPath);
   inputStream = assetFd.createInputStream();
   length = assetFd.getLength();
   } catch (FileNotFoundException e) {
   // Will occur if the file is compressed.
   inputStream = assetManager.open(assetPath);
   }
   String mimeType = getMimeTypeFromPath(assetPath);
   return new OpenForReadResult(uri, inputStream, mimeType, 
length, assetFd);
   }
   ```
   
   Adding `length = inputStream.available();` in the catch fixes the issue for 
me, but I'm not a java developer so can't evaluate if that's a bad idea for 
another reason.


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> 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] [Commented] (CB-13245) Filereader.readAsText fails on Android with long text files when

2017-09-05 Thread ASF GitHub Bot (JIRA)

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

ASF GitHub Bot commented on CB-13245:
-

GitHub user Beatinu opened a pull request:

https://github.com/apache/cordova-plugin-file/pull/217

CB-13245: (android) Fix bug caused by negative length reported for an asset



### Platforms affected
Android

### What does this PR do?
Check the length of CordovaResourceApi.OpenForReadResult in readFileAtURL() 
to fix loading Android assets with a length greater than 
FileReader.READ_CHUNK_SIZE. When the length returned is < 0, use 
InputStream.available() to get the length of compressed assets.

### What testing has been done on this change?
Fixes a bug in one of my apps when loading a large .json file into a string.

### Checklist
- [X] [Reported an issue](http://cordova.apache.org/contribute/issues.html) 
in the JIRA database
- [X] Commit message follows the format: "CB-3232: (android) Fix bug with 
resolving file paths", where CB- is the JIRA ID & "android" is the platform 
affected.
- [ ] Added automated test coverage as appropriate for this change.


You can merge this pull request into a Git repository by running:

$ git pull https://github.com/Beatinu/cordova-plugin-file master

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/cordova-plugin-file/pull/217.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #217


commit 63fe1b3a91d029f9105be4e55f6fef7ac6392934
Author: Daniel Behnen 
Date:   2017-09-05T17:21:04Z

Use input stream length when input length is negative to fix loading 
compressed assets




> 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
>
> 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
(v6.4.14#64029)

-
To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org
For additional commands, e-mail: issues-h...@cordova.apache.org