cordova-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <>
Subject [jira] [Commented] (CB-14197) createFile/writeFile does not consistently execute the 'write' action resulting in files of size 0
Date Fri, 20 Jul 2018 20:18:00 GMT


ASF GitHub Bot commented on CB-14197:

macdonst closed pull request #237: CB-14197: (all) Fix for createFile/writeFile silently failing
to send 'write' action

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/www/FileWriter.js b/www/FileWriter.js
index c6de375..75ec9dc 100644
--- a/www/FileWriter.js
+++ b/www/FileWriter.js
@@ -21,6 +21,7 @@
 var exec = require('cordova/exec');
 var FileError = require('./FileError');
+var FileReader = require('./FileReader');
 var ProgressEvent = require('./ProgressEvent');


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:

> createFile/writeFile does not consistently execute the 'write' action resulting in files
of size 0
> --------------------------------------------------------------------------------------------------
>                 Key: CB-14197
>                 URL:
>             Project: Apache Cordova
>          Issue Type: Bug
>          Components: cordova-plugin-file
>            Reporter: Will Fairclough
>            Priority: Major
> Occasionally when calling the *createFile* API the *write* action does not get called. It
was not very consistent though and it is very hard to reproduce. It seems as though the *onload*
event was not firing on the fileReader in the write method resulting in the file never getting
written and no callbacks being fired.
> {code:java}
> if (data instanceof File || (!isProxySupportBlobNatively && supportsBinary &&
data instanceof Blob)) {
>    var fileReader=new FileReader();
>    /* eslint-enable no-undef */
>    fileReader.onload=function () {
>    // Call this method again, with the arraybuffer as argument
>, this.result, true/* isPendingBlobReadResult
>    };
>    ...
> }
> {code}
> We found we would notice the issue more consistently when running the app in the Android
emulator subsequent times in a row with the command:
> {code:java}
> $ cordova run android{code}
> We fixed this by requiring the FileReader module:
> []
> With this change we have not noticed the issue anymore.
> I also believe this *ionic-native* issue is related to this:
> []

This message was sent by Atlassian JIRA

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message