The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
(fix): Storage preview file names from search results (#51914)
Gildas Garcia3f8bbd5a00fc
diff --git a/apps/studio/components/interfaces/Storage/StorageExplorer/PreviewPane.test.tsx b/apps/studio/components/interfaces/Storage/StorageExplorer/PreviewPane.test.tsxindex d56fd604f8a..4dadec6285f 100644--- a/apps/studio/components/interfaces/Storage/StorageExplorer/PreviewPane.test.tsx+++ b/apps/studio/components/interfaces/Storage/StorageExplorer/PreviewPane.test.tsx@@ -237,5 +237,17 @@ describe('PreviewPane', () => {// The next write will version it, so the history has to be on offer.expect(await screen.findByText('Versions')).toBeInTheDocument()})++ it('displays the file base name when it is not a deep path', async () => {+ selectedBucket.current = { ...selectedBucket.current, versioning_status: 'ENABLED' }+ renderPane({ name: 'photo.png' })+ expect(await screen.findByText('photo.png')).toBeInTheDocument()+ })++ it('displays the file base name when it is a deep path', async () => {+ selectedBucket.current = { ...selectedBucket.current, versioning_status: 'ENABLED' }+ renderPane({ name: 'nested/deep/photo.png' })+ expect(await screen.findByText('photo.png')).toBeInTheDocument()+ })})})diff --git a/apps/studio/components/interfaces/Storage/StorageExplorer/PreviewPane.tsx b/apps/studio/components/interfaces/Storage/StorageExplorer/PreviewPane.tsxindex ec9ad58089d..08bf39fcf72 100644--- a/apps/studio/components/interfaces/Storage/StorageExplorer/PreviewPane.tsx+++ b/apps/studio/components/interfaces/Storage/StorageExplorer/PreviewPane.tsx@@ -126,7 +126,7 @@ const CurrentFilePreview = ({<div className="shrink">{/* No `title`: the explorer rows use it as their handle, and a secondelement carrying the same one makes `getByTitle` ambiguous. */}- <p className="truncate text-sm font-medium text-foreground">{file.name}</p>+ <p className="truncate text-sm font-medium text-foreground">{getBaseFileName(file.name)}</p><div className="mt-0.5 flex flex-wrap items-center gap-x-1.5 truncate text-xs text-foreground-light">{mimeType}{size && <>, {size}</>}@@ -443,3 +443,7 @@ export const PreviewPane = () => {</div>)}++const getBaseFileName = (name: string) => {+ return name.split('/').filter(Boolean).pop() ?? name+}