Size storage helper function #18124
Replies: 1 comment
|
I think you had an example of this in Discord. The size of the file is not part of the data you send and is not used in the initial insert to storage so would not be available for insert RLS. Supabase storage currently does an insert with the pathname to test RLS, stores to s3 and then does an update with the size of the file in metadata. It is possible to use the size in that update RLS as it is in the metadata column and you could write a function or SQL to do so. I'm not sure though what would happen if you block the update with RLS. Supabase has already stored the file and inserted the initial row in storage.objects. |
Uh oh!
There was an error while loading. Please reload this page.
I think it would be useful to allow us to set all the possible settings we can configure on a bucket via the dashboard, through a SQL policy.
https://supabase.com/docs/guides/storage/access-control#helper-functions
We can do it to make a bucket public, and we can do it to restrict the file extensions through storage.extension(). The only thing we cannot do is the file size. It would make total sense to have a helper function called storage.size() or something.
This way we can complete the whole bucket policy via sql instead of having to manually set it on the dashboard.
All reactions