Hi Maria,

Thanks for your reply.

I just discovered new issue with BinaryUploader .

With the fix, it can send real datas instead of "[object ArrayBuffer]" .

This is working right with text files, but it's not working right with some bytes. For exemple a file with 0xc0 inside will be wrong encoded by the TextEncoder('utf8').

To solve that as XMLHttpRequest can send typed array (https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/Sending_and_Receiving_Binary_Data#sending_typed_arrays_as_binary_data), there is no need to convert to utf8 string,

So sending this :

element.send(_binaryData.array);
instead of

element.send(binaryData);
(line 610)
will solve this other issue.

I will make another PR, grouping theses 2 fixs

Fred

Le 2023-09-25 13:41, Maria Jose Esteve a écrit :

Hi,
If that's okay with you, let's let the colleagues who have touched this part of the SDK give their opinion. If everything is fine for them, I can accept the PR myself.

Hiedra

-----Mensaje original-----
De: cont...@cristallium.com <cont...@cristallium.com>
Enviado el: lunes, 25 de septiembre de 2023 9:01
Para: dev@royale.apache.org
Asunto: Re: BinaryUploader issue

Hi,

I have make a PR to fix the issue
(https://github.com/apache/royale-asjs/pull/1234)

Could you merge it ?

Thanks

Le 2023-09-21 10:34, cont...@cristallium.com a écrit :

Hi All,

I try to send binary data with BinaryUploader .

In short I do this :

var ba:BinaryData = new BinaryData();
ba.writeByte(255);
ba.writeByte(256);
ba.writeByte(-256);

ba.position = 0;

var bup:BinaryUploader = new BinaryUploader(); bup.url =
"http://.....";;

bup.method = HTTPConstants.POST;

bup.binaryData = ba;
bup.send();

This works fine except that I receive the following : "[object
ArrayBuffer]"

Looking at source of BinaryUploader.as, the issue is on line 577
:binaryData = _binaryData.data.toString()

_binaryData.data.toString() convert ArrayBuffer to "[object
ArrayBuffer]"

Do I miss something ?

Regards

--

Reply via email to