Skip to content

Commit 895eec3

Browse files
committed
fix(logs): execution files should always use our internal route
1 parent 1e21ec1 commit 895eec3

File tree

1 file changed

+4
-14
lines changed
  • apps/sim/app/workspace/[workspaceId]/logs/components/log-details/components/file-download

1 file changed

+4
-14
lines changed

apps/sim/app/workspace/[workspaceId]/logs/components/log-details/components/file-download/file-download.tsx

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,7 @@ function FileCard({ file, isExecutionFile = false, workspaceId }: FileCardProps)
7474
}
7575

7676
if (isExecutionFile) {
77-
const serveUrl =
78-
file.url || `/api/files/serve/${encodeURIComponent(file.key)}?context=execution`
77+
const serveUrl = `/api/files/serve/${encodeURIComponent(file.key)}?context=execution`
7978
window.open(serveUrl, '_blank')
8079
logger.info(`Opened execution file serve URL: ${serveUrl}`)
8180
} else {
@@ -88,16 +87,12 @@ function FileCard({ file, isExecutionFile = false, workspaceId }: FileCardProps)
8887
logger.warn(
8988
`Could not construct viewer URL for file: ${file.name}, falling back to serve URL`
9089
)
91-
const serveUrl =
92-
file.url || `/api/files/serve/${encodeURIComponent(file.key)}?context=workspace`
90+
const serveUrl = `/api/files/serve/${encodeURIComponent(file.key)}?context=workspace`
9391
window.open(serveUrl, '_blank')
9492
}
9593
}
9694
} catch (error) {
9795
logger.error(`Failed to download file ${file.name}:`, error)
98-
if (file.url) {
99-
window.open(file.url, '_blank')
100-
}
10196
} finally {
10297
setIsDownloading(false)
10398
}
@@ -198,8 +193,7 @@ export function FileDownload({
198193
}
199194

200195
if (isExecutionFile) {
201-
const serveUrl =
202-
file.url || `/api/files/serve/${encodeURIComponent(file.key)}?context=execution`
196+
const serveUrl = `/api/files/serve/${encodeURIComponent(file.key)}?context=execution`
203197
window.open(serveUrl, '_blank')
204198
logger.info(`Opened execution file serve URL: ${serveUrl}`)
205199
} else {
@@ -212,16 +206,12 @@ export function FileDownload({
212206
logger.warn(
213207
`Could not construct viewer URL for file: ${file.name}, falling back to serve URL`
214208
)
215-
const serveUrl =
216-
file.url || `/api/files/serve/${encodeURIComponent(file.key)}?context=workspace`
209+
const serveUrl = `/api/files/serve/${encodeURIComponent(file.key)}?context=workspace`
217210
window.open(serveUrl, '_blank')
218211
}
219212
}
220213
} catch (error) {
221214
logger.error(`Failed to download file ${file.name}:`, error)
222-
if (file.url) {
223-
window.open(file.url, '_blank')
224-
}
225215
} finally {
226216
setIsDownloading(false)
227217
}

0 commit comments

Comments
 (0)