How to preview an image Attachment in a Task if an Attachment is added via API

When I add an image Attachment to a Task via web UI on Asana task, the Attachment is shown as an image in among comments, so I see the preview of this image.

However if I add an image Attachment via Rest API, it is shown as clickable div, and if to click on it the image will be downloaded.

What is happening? What flag has to be set to see or preview an image Attachment as picture among other Task comments?