Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

Briefly simplify downloading of file in storage from preview pane

Joshen Limc7dc5f466664
diff --git a/studio/components/to-be-cleaned/Storage/StorageExplorer/PreviewPane.js b/studio/components/to-be-cleaned/Storage/StorageExplorer/PreviewPane.js
index 0bc5f4da5d8..38b05a2c691 100644
--- a/studio/components/to-be-cleaned/Storage/StorageExplorer/PreviewPane.js
+++ b/studio/components/to-be-cleaned/Storage/StorageExplorer/PreviewPane.js
@@ -10,6 +10,7 @@ import {
import SVG from 'react-inlinesvg'
import { formatBytes } from 'lib/helpers'
import { Transition } from '@headlessui/react'
+import Link from 'next/link'
const PreviewFile = ({ mimeType, previewUrl }) => {
if (!mimeType || !previewUrl) {
@@ -92,7 +93,6 @@ const PreviewPane = ({
file = {},
width = 400,
onCopyFileURL = () => {},
- onDownloadFile = () => {},
onSelectFileDelete = () => {},
onClosePreviewPane = () => {},
}) => {
@@ -168,14 +168,17 @@ const PreviewPane = ({
{/* Actions */}
<div className="flex space-x-2 border-b border-panel-border-light pb-4 dark:border-panel-border-dark">
- <Button
- type="default"
- icon={<IconDownload size={16} strokeWidth={2} />}
- onClick={() => onDownloadFile(file)}
- disabled={file.isCorrupted}
- >
- Download
- </Button>
+ <Link href={`${file.previewUrl}&download`}>
+ <a>
+ <Button
+ type="default"
+ icon={<IconDownload size={16} strokeWidth={2} />}
+ disabled={file.isCorrupted}
+ >
+ Download
+ </Button>
+ </a>
+ </Link>
<Button
type="outline"
icon={<IconClipboard size={16} strokeWidth={2} />}
diff --git a/studio/components/to-be-cleaned/Storage/StorageExplorer/StorageExplorer.js b/studio/components/to-be-cleaned/Storage/StorageExplorer/StorageExplorer.js
index de10f46aefe..831b5cfc906 100644
--- a/studio/components/to-be-cleaned/Storage/StorageExplorer/StorageExplorer.js
+++ b/studio/components/to-be-cleaned/Storage/StorageExplorer/StorageExplorer.js
@@ -353,7 +353,6 @@ const StorageExplorer = observer(({ bucket }) => {
file={selectedFilePreview}
width={previewPaneWidth}
onCopyFileURL={onCopyFileURL}
- onDownloadFile={onDownloadFile}
onSelectFileDelete={onSelectItemDelete}
onClosePreviewPane={closeFilePreview}
/>