https://supabase.com/ logo
Hi there! I've been having a bit of trouble gettin...
# help
e
Hi there! I've been having a bit of trouble getting the
Content-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):
Copy code
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!!
n
Hello @edouard-harris! This thread has been automatically created from your message in #843999948717555735 a few seconds ago. We have already mentioned the @User so that they can see your message and help you as soon as possible! Want to unsubscribe from this thread? Right-click the thread in Discord (or use the ``...`` menu) and select "Leave Thread" to unsubscribe from future updates. Want to change the title? Use the ``/title`` command! We have solved your problem? Click the button below to archive it.
g
Storage does not process the disposition header in your upload or have an option to set it. https://github.com/supabase/storage-api/issues/122
e
Ah. Well that explains it then. Thanks for the quick response @garyaustin 👍