File tree Expand file tree Collapse file tree
apps/sim/lib/copilot/tools/server/files Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -541,12 +541,9 @@ export async function resolveServableDocBytes(args: {
541541 }
542542 }
543543
544- // Reaches here only for xlsx, which has no isolated-vm fallback. With workspace
545- // context, returning these bytes would expose generation source as a spreadsheet.
546- if ( ! format ) {
547- if ( workspaceId ) throw new DocCompileUserError ( 'Document is still being generated' )
548- return { buffer : rawBuffer , contentType : getContentType ( fileName ) }
549- }
544+ // Reaches here only for xlsx, which has no isolated-vm fallback. Returning these
545+ // bytes would expose generation source as a spreadsheet.
546+ if ( ! format ) throw new DocCompileUserError ( 'Document is still being generated' )
550547
551548 const cacheKey = sha256Hex ( `${ ext } ${ source } ${ workspaceId ?? '' } ` )
552549 const cached = compiledDocCache . get ( cacheKey )
Original file line number Diff line number Diff line change @@ -173,14 +173,15 @@ describe('resolveServableDocBytes', () => {
173173 expect ( mockRunSandboxTask ) . not . toHaveBeenCalled ( )
174174 } )
175175
176- it ( 'returns raw XLSX source when there is no workspaceId (xlsx has no isolated-vm path)' , async ( ) => {
177- const result = await resolveServableDocBytes ( {
178- rawBuffer : XLSX_SOURCE ,
179- fileName : 'sheet.xlsx' ,
180- workspaceId : undefined ,
181- } )
176+ it ( 'throws instead of returning XLSX source when there is no workspaceId' , async ( ) => {
177+ await expect (
178+ resolveServableDocBytes ( {
179+ rawBuffer : XLSX_SOURCE ,
180+ fileName : 'sheet.xlsx' ,
181+ workspaceId : undefined ,
182+ } )
183+ ) . rejects . toBeInstanceOf ( DocCompileUserError )
182184
183- expect ( result . buffer ) . toBe ( XLSX_SOURCE )
184185 expect ( mockLoadCompiledDoc ) . not . toHaveBeenCalled ( )
185186 expect ( mockRunSandboxTask ) . not . toHaveBeenCalled ( )
186187 } )
You can’t perform that action at this time.
0 commit comments