edouard-harris
06/20/2022, 6:48 PMContent-Disposition header to work correctly when using the REST API for storage.
Here's a prototypical example, using the Python requests package. I'm trying to upload the image test-image.png to the bucket my-bucket, such that after it's been uploaded, navigating to the image URL will cause the browser to open the image in a preview (as opposed to downloading it):
requests.post(
'https://abcxyz.supabase.co/storage/v1/object/my-bucket/test-image.png',
headers={
'Content-Type': 'image/png',
'Authorization': 'Bearer abc123',
'Content-Disposition': 'inline'
},
data=imageFile.read()
)
The problem is that, on testing, the image behaves as though I'd set 'Content-Disposition': 'attachment', and downloads the image instead of opening it in a preview window. Any thoughts on how to fix this?
Thanks!!Needle
06/20/2022, 6:48 PMgaryaustin
06/20/2022, 7:22 PMedouard-harris
06/20/2022, 7:41 PM