Skip to content

Commit 13c4919

Browse files
committed
fix(files): address PR review — fix xlsx type, simplify error helper, tighten iframe sandbox
1 parent edc103d commit 13c4919

File tree

1 file changed

+3
-3
lines changed
  • apps/sim/app/workspace/[workspaceId]/files/components/file-viewer

1 file changed

+3
-3
lines changed

apps/sim/app/workspace/[workspaceId]/files/components/file-viewer/file-viewer.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -620,7 +620,7 @@ const ImagePreview = memo(function ImagePreview({ file }: { file: WorkspaceFileR
620620
})
621621

622622
function resolvePreviewError(fetchError: Error | null, renderError: string | null): string | null {
623-
if (fetchError) return fetchError instanceof Error ? fetchError.message : 'Failed to load file'
623+
if (fetchError) return fetchError.message
624624
return renderError
625625
}
626626

@@ -955,7 +955,7 @@ const DocxPreview = memo(function DocxPreview({
955955
<div className='flex flex-1 overflow-hidden'>
956956
<iframe
957957
srcDoc={buildDocxPreviewHtml(html)}
958-
sandbox='allow-same-origin'
958+
sandbox=''
959959
title={file.name}
960960
className='h-full w-full border-0'
961961
/>
@@ -1013,7 +1013,7 @@ const XlsxPreview = memo(function XlsxPreview({
10131013
try {
10141014
setRenderError(null)
10151015
const XLSX = await import('xlsx')
1016-
const workbook = XLSX.read(data, { type: 'array' })
1016+
const workbook = XLSX.read(new Uint8Array(data), { type: 'array' })
10171017
if (!cancelled) {
10181018
workbookRef.current = workbook
10191019
setSheetNames(workbook.SheetNames)

0 commit comments

Comments
 (0)