File tree Expand file tree Collapse file tree
apps/sim/app/(interfaces)/chat/components/message/components Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -29,6 +29,7 @@ class DirectDownloadRequiredError extends Error {
2929
3030async function fetchExternalFile ( url : string ) : Promise < Response > {
3131 try {
32+ // boundary-raw-fetch: external binary download from an already validated HTTP URL
3233 return await fetch ( url , { cache : 'no-store' } )
3334 } catch {
3435 /** A navigation can download external files whose hosts do not allow CORS reads. */
@@ -95,10 +96,13 @@ async function triggerDownload(file: ChatFile): Promise<void> {
9596 if ( ! url ) throw new Error ( 'File has no download URL' )
9697
9798 /** The same serve route as execution logs resolves current storage access on each click. */
98- let response = hasStorageKey
99- ? // boundary-raw-fetch: binary file download through the authorized serve route
100- await fetch ( url , { cache : 'no-store' } )
101- : await fetchExternalFile ( url )
99+ let response : Response
100+ if ( hasStorageKey ) {
101+ // boundary-raw-fetch: binary file download through the authorized serve route
102+ response = await fetch ( url , { cache : 'no-store' } )
103+ } else {
104+ response = await fetchExternalFile ( url )
105+ }
102106 if ( hasStorageKey && response . status === 401 && isSafeHttpUrl ( file . url ) ) {
103107 await response . body ?. cancel ( )
104108 /** Public chat visitors may only have the file access already delivered in the response. */
You can’t perform that action at this time.
0 commit comments