The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
Add bucket name validation
Neeraj Walia9ba9ab70977d
diff --git a/studio/pages/api/storage/[ref]/buckets/index.ts b/studio/pages/api/storage/[ref]/buckets/index.tsindex e426db1810c..e7a968948d5 100644--- a/studio/pages/api/storage/[ref]/buckets/index.ts+++ b/studio/pages/api/storage/[ref]/buckets/index.ts@@ -33,6 +33,13 @@ const handleGet = async (req: NextApiRequest, res: NextApiResponse) => {const handlePost = async (req: NextApiRequest, res: NextApiResponse) => {const { id, public: isPublicBucket } = req.body+ // To validate bucket name, can be removed once the issue is fixed in supabase lib+ const regex = /^[a-z0-9.-]+$/+ if (!regex.test(id)) {+ return res.status(400).json({ error: { message: 'Bucket name invalid' } })+ }+ // Bucket name validation ends here+const { data, error } = await supabase.storage.createBucket(id, { public: isPublicBucket })if (error) {return res.status(400).json({ error: { message: error.message } })