supabase / storage

S3 compatible object storage service that stores metadata in Postgres
https://supabase.com/docs/guides/storage
Apache License 2.0
764 stars 107 forks source link

Signed upload URL for existing files in blob storage #380

Closed IzStriker closed 5 months ago

IzStriker commented 1 year ago

Discussed in https://github.com/orgs/supabase/discussions/14538

Originally posted by **IzStriker** May 23, 2023 Hi. I noticed it isn't possible to create a signed upload URL for existing objects in blob storage. Yet it seems that the storage-js library has the functionality to upsert files via a signed upload URL. Was there a specific reason the decision was made for this restriction, technical or otherwise? If not I would be more than happy to contribute to resolve this. Generating signed upload URL for existing object error: https://github.com/supabase/storage-api/blob/81e9b7b6ed762f2f21bce9f39dd3b4cf7ce38a7a/src/storage/object.ts#LL534C3-L537C1 Upseritng file via supabase storage js client: https://github.com/supabase/storage-js/blob/b2e3486222126620cc65a5a1c1f967d25b4fb099/src/packages/StorageFileApi.ts#LL83C3-L85C8
zekida commented 5 months ago

i also bumped into this issue and ended up here. we are creating a multiple documents upload page, where i intended to create signedUploadUrls for all documents on page load(matched with session time). uploads are meant to be all 'upsert' so overwrites are intended.

currently my only work around is have an API endpoint that would delete the target object, then create an uploadUrl which will be sent to the client, and client uploads file with signedUploadUrl - for each document upload.

this is perhaps ironic as OP mentions, upserting is possible with signedUploadUrl, but we can't create a signedUploadUrl if object exists.

seems like an easy fix, as OP pointed out. was there a technical reason for blocking this?

github-actions[bot] commented 5 months ago

:tada: This issue has been resolved in version 1.1.0 :tada:

The release is available on GitHub release

Your semantic-release bot :package::rocket: