Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

API route clash with existing buckets named public or sign #22

Closed
inian opened this issue May 22, 2021 · 1 comment · Fixed by #24
Closed

API route clash with existing buckets named public or sign #22

inian opened this issue May 22, 2021 · 1 comment · Fixed by #24
Assignees
Labels
bug Something isn't working

Comments

@inian
Copy link
Member

inian commented May 22, 2021

User report

So there are three different ways to access objects now

/object/avatars/grumpy.jpg -> getObject -> needs auth header
/object/sign/avatars/grumpy.jpg -> getSignedObject -> needs token query param
/object/public/avatars/grumpy.jpg -> getPublicObject -> needs bucket to be public

We need a better way to disambiguate downloading from existing buckets named public or sign and getPublicObject and getSignedObject operations respectively.

@inian inian added the bug Something isn't working label May 22, 2021
@inian inian self-assigned this May 22, 2021
@inian
Copy link
Member Author

inian commented May 22, 2021

Options

Change getObject to start with /object/auth

  • /object/authenticated/avatars/grumpy.jpg -> getObject -> needs auth header
  • /object/sign/avatars/grumpy.jpg -> getSignedObject -> needs token query param
  • /object/public/avatars/grumpy.jpg -> getPublicObject -> needs bucket to be public

Advantage is that is aligns more closely with /sign and /public in terms of URL structure. Bucket names can be anything.
Problem is everyone will need to upgrade their supabase-js library since this is a breaking change for someone using the getObject API.

Change /object/public/avatars/grumpy.jpg to a new route called /public-object/avatars/grumpy.jpg

Advantage is that there is no breaking change. Bucket can't be named as sign but I guess no one is doing that. Other disadvantage is that API looks messy compared to option 1 but I guess that's fine too.

I think option 2 will be the least messy and during the next breaking change, we move to option 1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant