SupabaseS
Supabase11mo ago
Loomer

Storage RLS Template not working

Hi,

i used the RLS Template to restrict insert only to a subfolder in my storage bucket:

CREATE POLICY "policy_name"
ON storage.objects FOR {operation} {USING | WITH CHECK} (
    -- restrict bucket
    bucket_id = {bucket_name}
    and auth.uid()::text = (storage.foldername(name))[1]
);


still i can upload files

const folderPath = `test/${pdfFilename}`;
            const { data, error } = await supabase.storage
                .from("invoices")
                .upload(folderPath, blob, {
                    contentType: "application/pdf",
                    upsert: true,
                });


into the "test" folder for my understanding it should not work
Was this page helpful?