I don't think the bucket is public. What is the di...
# help
j
I don't think the bucket is public. What is the difference between public and private?
g
You set public or not when you create the bucket, it is a toggle.
You set up policies just like RLS on tables to update/insert, but they are in the storage sections.
https://supabase.com/docs/reference/javascript/storage-from-update shows the policies you need for update of storage object.
Oh Public means the bucket can be read by anyone with the "url" to it.
If not public you have to download the file or get a temp link to it.
And to be clear you need policies even on a public bucket, just allows access with just a url for reading it.
j
Ahhh ok! That is more clear! But when is it okay to make the bucket public? If it's public, does the link to the bucket five access to a file directory to anyone?
And do I have to set policy for the bucket only? What is the 'Other policies under storage.objects' and 'Policies under storage.buckets'?
g
Probably better to ask a new question on specific policies on that last question so someone else can jump in, or do more research... I've only used policies under each bucket at the top of the UI.
Public means anyone given (or guessing) the URL can read the bucket as auth is not used at all.
u
Hello everyone, what do I need to update an image? All my requests are answered with status 400
g
@User you will need to add an update policy (like RLS policies) in the storage policy section.
u
create policy "Anyone can update an image." on storage.objects for update with check ( bucket_id = 'produtos' );
is this correct?
g
On update you need both a "using" and "with check" or just "using". For insert(upload) you need just "with check"
u
ok thanks