How to open blobs on browser without downloading through java service?

前端 未结 2 1392
陌清茗
陌清茗 2020-12-21 15:04

I am creating an application where I need to view blobs in browser rather than downloading them. Currently, links of blobs having token downloads the corresponding blob.

2条回答
  •  一向
    一向 (楼主)
    2020-12-21 15:52

    First thing you would want to check is the content-type property of the blob. In all likelihood, the content type of the blob would be application/octet-stream (which is the default content type). Because of this the browser is not understanding what to do with this blob and thus downloading it. Please try to change the content type of the blob to appropriate value (e.g. image/png) and that should fix the problem.

    Also I noticed that you're setting the container's ACL to BlobContainerPublicAccessType.CONTAINER. If you're doing this, then there's no need for you to create Shared Access Signature (SAS). Your blobs will be accessible simply by their URL (https://accountname.blob.core.windows.net/containername/blobname). SAS comes into play when the container's ACL is Private.

提交回复
热议问题