Search code examples
androidcordovacordova-pluginshtml5-filesystem

Both error and success callbacks in the same write


When saving files using a FileWriter, the error and success callbacks fire both. This only happens on certain android devices (v4.3 & v5) while working on others. The plugin version is 2.0.0

The FileError has code 6 which is "NO_MODIFICATION_ALLOWED_ERR".

Here some code:

this.cwd.getFile(id, {create: true}, function(file) {
    file.createWriter(function(writer) {

        writer.onerror = fail;

        writer.onwriteend = function() {
            success(id, file.toURL());
        };

        writer.write(blob);

    }, fail);
}, fail);

Bug in the plugin?


Solution

  • Oh damn! Plugin v2.1 is available and solves the issue...