mirror of
https://github.com/simstudioai/sim.git
synced 2026-04-06 03:00:16 -04:00
fix: bust browser cache for workspace file downloads
The downloadFile function was using a plain fetch() that honored the aggressive cache headers, causing newly created files to download empty. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -115,8 +115,8 @@ function formatFileType(mimeType: string | null, filename: string): string {
|
||||
}
|
||||
|
||||
async function downloadFile(file: WorkspaceFileRecord) {
|
||||
const serveUrl = `/api/files/serve/${encodeURIComponent(file.key)}?context=workspace`
|
||||
const response = await fetch(serveUrl)
|
||||
const serveUrl = `/api/files/serve/${encodeURIComponent(file.key)}?context=workspace&t=${Date.now()}`
|
||||
const response = await fetch(serveUrl, { cache: 'no-store' })
|
||||
if (!response.ok) {
|
||||
throw new Error(`Failed to download file: ${response.statusText}`)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user