cordova-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Kamil Durkiewicz (JIRA)" <j...@apache.org>
Subject [jira] [Created] (CB-7927) [WP8][cordova-plugin-file] Unable to write a binary file.
Date Mon, 03 Nov 2014 13:06:33 GMT
Kamil Durkiewicz created CB-7927:
------------------------------------

             Summary: [WP8][cordova-plugin-file] Unable to write a binary file.
                 Key: CB-7927
                 URL: https://issues.apache.org/jira/browse/CB-7927
             Project: Apache Cordova
          Issue Type: Bug
          Components: Plugin File
    Affects Versions: 3.5.0
            Reporter: Kamil Durkiewicz


When this code is run on Windows Phone:

```
// a valid base64-encoded image:
        var imgData = '/9j/4AAQSkZJRgABAQEAYABgAAD/2wBDAAIBAQIBAQICAgICAgICAwUDAwMDAwYEBAMFBwYHBwcGBwcICQsJCAgKCAcHCg0KCgsMDAwMBwkODw0MDgsMDAz/2wBDAQICAgMDAwYDAwYMCAcIDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAz/wAARCAAHAAgDASIAAhEBAxEB/8QAHwAAAQUBAQEBAQEAAAAAAAAAAAECAwQFBgcICQoL/8QAtRAAAgEDAwIEAwUFBAQAAAF9AQIDAAQRBRIhMUEGE1FhByJxFDKBkaEII0KxwRVS0fAkM2JyggkKFhcYGRolJicoKSo0NTY3ODk6Q0RFRkdISUpTVFVWV1hZWmNkZWZnaGlqc3R1dnd4eXqDhIWGh4iJipKTlJWWl5iZmqKjpKWmp6ipqrKztLW2t7i5usLDxMXGx8jJytLT1NXW19jZ2uHi4+Tl5ufo6erx8vP09fb3+Pn6/8QAHwEAAwEBAQEBAQEBAQAAAAAAAAECAwQFBgcICQoL/8QAtREAAgECBAQDBAcFBAQAAQJ3AAECAxEEBSExBhJBUQdhcRMiMoEIFEKRobHBCSMzUvAVYnLRChYkNOEl8RcYGRomJygpKjU2Nzg5OkNERUZHSElKU1RVVldYWVpjZGVmZ2hpanN0dXZ3eHl6goOEhYaHiImKkpOUlZaXmJmaoqOkpaanqKmqsrO0tba3uLm6wsPExcbHyMnK0tPU1dbX2Nna4uPk5ebn6Onq8vP09fb3+Pn6/9oADAMBAAIRAxEAPwDkPhh8d/FOp/FTxr8TbCfxDomsWlums6rc6DqktjA9iJo4BaXKx3EN3cpcXs2mxyT/AGs3ABmnk+0SkyKUUVHF3FFbA0MPWhRpTc3VjacOZJUqjpx5U37vuxV0rRbV7Jt3/urgfw0yrPMbjqGKqVYKh7DldOo4N+2oQrS52vjanOXK5Xaj7t2kj//Z',
            path = 'testImage.jpeg';

        var byteArray = base64DecToArr(imgData).buffer;

        window.requestFileSystem(
            LocalFileSystem.PERSISTENT,
            0,
            function(fileSystem) {
                fileSystem.root.getFile(path, { create: true }, function(fileEntry) {
                    fileEntry.createWriter(function(writer) {
                        writer.write(byteArray);
                        writer.onwriteend = function(evt) {
                            alert('write end');
                        };
                    })
                });
            });
```

The file that is written is not a valid jpeg file. This issue is caused by deserialization
of bytes into `char[]` instead of `byte[]`.



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


Mime
View raw message