From 521cba7dd38af20de767fb536aaad12b47e3a16d Mon Sep 17 00:00:00 2001 From: mk3ext Date: Wed, 5 Jun 2024 06:43:04 +0100 Subject: [PATCH] fix(web): update schema.sql for supabase, fixes file upload (#31) The RLS policy restricted non-uuid file names from being uploaded to ANY bucket. This was caused by the "or" condition in the policy. This fixes that by wrapping both "or" conditions in a single set of parentheses. --- apps/web/supabase/migrations/20221215192558_schema.sql | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/apps/web/supabase/migrations/20221215192558_schema.sql b/apps/web/supabase/migrations/20221215192558_schema.sql index b7f50434a..ad0e4ed17 100644 --- a/apps/web/supabase/migrations/20221215192558_schema.sql +++ b/apps/web/supabase/migrations/20221215192558_schema.sql @@ -2733,7 +2733,7 @@ create policy account_image on storage.objects for all using ( with check ( bucket_id = 'account_image' - and kit.get_storage_filename_as_uuid (name) = ( + and (kit.get_storage_filename_as_uuid (name) = ( select auth.uid () ) @@ -2741,5 +2741,5 @@ with auth.uid (), kit.get_storage_filename_as_uuid (name), 'settings.manage' - ) - ); + )) + ); \ No newline at end of file