Skip to main content

@rtorcato/supabase-common / parsePublicUrl

Function: parsePublicUrl()

parsePublicUrl(url): { bucket: string; path: string; } | null

Defined in: storage.ts:91

Inverse of publicUrl: pull { bucket, path } back out of a public object URL, or null if it isn't one. Query string / hash (e.g. ?download) is ignored; the path is percent-decoded when it decodes cleanly.

parsePublicUrl('https://abc.supabase.co/storage/v1/object/public/avatars/a.png') // → { bucket: 'avatars', path: 'a.png' }

Parameters

url

string

Returns

{ bucket: string; path: string; } | null