Skip to content

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

Fix copying url in storage explorer returns object Promise

Joshen Lima6fd450c0462
diff --git a/studio/localStores/storageExplorer/StorageExplorerStore.js b/studio/localStores/storageExplorer/StorageExplorerStore.js
index 37641c47ac6..2c30d660945 100644
--- a/studio/localStores/storageExplorer/StorageExplorerStore.js
+++ b/studio/localStores/storageExplorer/StorageExplorerStore.js
@@ -8,7 +8,7 @@ import { createClient } from '@supabase/supabase-js'
import { useStore } from 'hooks'
import { copyToClipboard } from 'lib/helpers'
import { API_URL, IS_PLATFORM } from 'lib/constants'
-import { get, patch, post, delete_ } from 'lib/common/fetch'
+import { post, delete_ } from 'lib/common/fetch'
import { PROJECT_ENDPOINT_PROTOCOL } from 'pages/api/constants'
import {
STORAGE_VIEWS,
@@ -407,15 +407,12 @@ class StorageExplorerStore {
})
} else {
// Need to generate signed URL, and might as well save it to cache as well
- const signedUrlAsync = this.fetchFilePreview(file.name, expiresIn).then((signedUrl) => {
- const formattedUrl = new URL(signedUrl)
- formattedUrl.searchParams.set('t', new Date().toISOString())
-
- return formattedUrl.toString()
- })
+ const signedUrl = await this.fetchFilePreview(file.name, expiresIn)
+ const formattedUrl = new URL(signedUrl)
+ formattedUrl.searchParams.set('t', new Date().toISOString())
try {
- copyToClipboard(signedUrlAsync, () => {
+ copyToClipboard(formattedUrl.toString(), () => {
this.ui.setNotification({
category: 'success',
message: `Copied URL for ${file.name} to clipboard.`,
@@ -424,7 +421,7 @@ class StorageExplorerStore {
})
const fileCache = {
id: file.id,
- url: await signedUrlAsync,
+ url: formattedUrl.toString(),
expiresIn: DEFAULT_EXPIRY,
fetchedAt: Date.now(),
}