Skip to content

Storage: option to set Content-Disposition: attachment header #251

Description

@catlan

Feature request

It would be nice to have the option to set Content-Disposition: attachment header for storage object to allow download of images in the browser, instead of the browser displaying them inline.

Is your feature request related to a problem? Please describe.

The HTML a download attribute, like
<a href="https://[project_ref].supabase.co/storage/v1/object/public/[id]" download>Image Download</a>, only works for same-origin. See https://stackoverflow.com/a/49736875/23028

Describe the solution you'd like

Adding parameter like Image Transformations

https://project_id.supabase.co/storage/v1/render/image/public/bucket/image.jpg?download=true

Or add to option to the uploading/updating API, like the existing Content-Type FileOptions.

	const { data, error } = await supabase.storage
		.from('avatars')
		.upload('public/avatar1.png', avatarFile, {
			contentDisposition: 'attachment'
		}) 

Describe alternatives you've considered

A roundabout workaround would be to create your own API end point that sets the Content-Disposition: attachment header and stream the data from the storage.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions