You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cordova.apache.org by "ASF GitHub Bot (JIRA)" <ji...@apache.org> on 2016/08/16 09:13:20 UTC
[jira] [Commented] (CB-11699) FileReader.READ_CHUNK_SIZE is not
working with Base64 conversion
[ https://issues.apache.org/jira/browse/CB-11699?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15422468#comment-15422468 ]
ASF GitHub Bot commented on CB-11699:
-------------------------------------
GitHub user vladimir-kotikov opened a pull request:
https://github.com/apache/cordova-plugin-file/pull/191
CB-11699 Read files as Data URLs properly
<!--
Please make sure the checklist boxes are all checked before submitting the PR. The checklist
is intended as a quick reference, for complete details please see our Contributor Guidelines:
http://cordova.apache.org/contribute/contribute_guidelines.html
Thanks!
-->
### Platforms affected
Android, iOS, Windows
### What does this PR do?
This PR fixes reading files as data URLs by modifying chunk size, so concatenated chunks would be a valid Data URL
### What testing has been done on this change?
Ran plugin tests on all affected platforms
### Checklist
- [x] [ICLA](http://www.apache.org/licenses/icla.txt) has been signed and submitted to secretary@apache.org.
- [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-xxxx is the JIRA ID & "android" is the platform affected.
- [x] Added automated test coverage as appropriate for this change.
When reading file as Data URL, CHUNK_SIZE must be divisible by 3, otherwise the resultant string, made by concatenating chunks, will not be a valid Base64 encoded Data URL. Also Windows do not support reading sliced files as data URLs, so we need to set chunk size equal to file size.
Relevant JIRA issues: [CB-11699](https://issues.apache.org/jira/browse/CB-11699), [CB-11199](https://issues.apache.org/jira/browse/CB-11199)
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/vladimir-kotikov/cordova-plugin-file CB-11699
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/cordova-plugin-file/pull/191.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 #191
----
commit 3bc49455963e873af457a440ea240d5422d01865
Author: Vladimir Kotikov <ko...@gmail.com>
Date: 2016-08-16T08:20:03Z
CB-11699 Read files as Data URLs properly
When reading file as Data URL, CHUNK_SIZE must be divisible by 3,
otherwise the resultant string made by concatenating chunks will
not be a valid Base64 encoded Data URL.
Also Windows do not support reading sliced files as data URLs, so we
set chunk size equal to file size
----
> FileReader.READ_CHUNK_SIZE is not working with Base64 conversion
> ----------------------------------------------------------------
>
> Key: CB-11699
> URL: https://issues.apache.org/jira/browse/CB-11699
> Project: Apache Cordova
> Issue Type: Bug
> Components: Plugin File
> Affects Versions: 4.2.0
> Environment: Bug in JavaScript so all platforms will be affected
> Reporter: Tony Leung
>
> CB-7862 - the fix for reading files in chunks defined the chunk size as follow:
> FileReader.READ_CHUNK_SIZE = 256*1024;
> I found a bug on iOS that readAsDataURL in CDVFile.m, converting it to Base64 will not work because the chunk size 262144 is not dividable by 3.
> The quick fix will be FileReader.READ_CHUNK_SIZE = (256*1024) - 1
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org