Using ZnEasy getPng: with an octet-stream

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Using ZnEasy getPng: with an octet-stream

Andy Burnett
Next step of my Asana adventure.

In a browser


downloads a png.

When I try ZnEasy getPng: with the same address, I get a walkback saying expected image/png actual application/octet-stream.

Is it possible to handle this with ZnEasy, or do I have to use the ZnClient and handle the stream first?

Cheers
Andy

Reply | Threaded
Open this post in threaded view
|

Re: Using ZnEasy getPng: with an octet-stream

Sven Van Caekenberghe-2


> On 28 Aug 2018, at 00:41, Andy Burnett <[hidden email]> wrote:
>
> Next step of my Asana adventure.
>
> In a browser
>
> https://s3.amazonaws.com/profile_photos/206785263586755.0mU1QMOxVZLp3WiRWhWX_128x128.png
>
> downloads a png.
>
> When I try ZnEasy getPng: with the same address, I get a walkback saying expected image/png actual application/octet-stream.

In AWS S3 you have to set the correct mime-type when you upload a file, this can also be changed afterwards. If not, it remains binary (application/octet-stream).

It is possible to derive mime-types from extensions, though that is not perfect. See ZnMimeType class>>#forFilenameExtension:

> Is it possible to handle this with ZnEasy,

Not as it is today.

> or do I have to use the ZnClient and handle the stream first?

Yes, get the bytes and create the Form yourself.

> Cheers
> Andy
>