It’s a little counter intuitive but, as per the Supabase documentation, despite the bucket being public, you need to create a policy on storage objects for the list all files function to return all the objects from your storage bucket:
Hello, I see you guys are having a little bit of troubles with this, actually, even though it can be daunting at first, it follows the same rules as the Supabase’s tables.
By default, you want to have storage.buckets without policies, you want it to be locked down. In the storage.buckets, as @Joyce already found out, you set the rules for every bucket, which is not always what you want.
To manage the singular bucket’s rules, you need to add an identifier, bucket_id = 'your_bucket_name'::text to your RLS policy. See the example underneath, that allows anyone authenticated select from my brucket bucket.
With the knowledge of these helper functions, you should be able to pull off something like for example having a profiles bucket, where each user has a folder /{user_id} which would be their auth.users.uuid and you should be able to limit the CRUD actions to only folders with their id in the folder name. It might look something like this (I pulled this together in 5 secs, so I haven’t tested it):
Great thanks for the good response.
I actually enden up making some good policies for my buckets. I think my biggest confusion was the workflow action seamingly not working. And then ofcource a frustration of not being able to find dokumentation to that action.
But i guess its quite important to understand that public does not mean that it can be listet
Again thanks to both of you to take the time and make me Smarter