Skip to content

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

fix:add cache busting logic for copying file url to clipboard

Joshen Lim8b461804c5f7
diff --git a/studio/localStores/storageExplorer/StorageExplorerStore.js b/studio/localStores/storageExplorer/StorageExplorerStore.js
index 3eb66d6d031..970d867b712 100644
--- a/studio/localStores/storageExplorer/StorageExplorerStore.js
+++ b/studio/localStores/storageExplorer/StorageExplorerStore.js
@@ -337,7 +337,6 @@ class StorageExplorerStore {
this.selectedFilePreview = { ...file, previewUrl: cachedPreview.url }
} else {
const previewUrl = await this.fetchFilePreview(file.name)
-
const formattedPreviewUrl = this.selectedBucket.public
? `${previewUrl}?t=${new Date().toISOString()}`
: previewUrl
@@ -374,12 +373,13 @@ class StorageExplorerStore {
} else {
// Need to generate signed URL, and might as well save it to cache as well
const signedUrl = await this.fetchFilePreview(file.name)
- copyToClipboard(signedUrl, () => {
+ const formattedUrl = `${signedUrl}?t=${new Date().toISOString()}`
+ copyToClipboard(formattedUrl, () => {
toast(`Copied URL for ${file.name} to clipboard.`)
})
const fileCache = {
id: file.id,
- url: signedUrl,
+ url: formattedUrl,
expiresIn: DEFAULT_EXPIRY,
fetchedAt: Date.now(),
}