Skip to content

Commit 809c9d4

Browse files
committed
fix(files): address PR review findings
- csp.ts: revert bare https: from img-src — it defeats the existing domain allowlist and opens info-leakage vectors - files/page.tsx + files/[fileId]/page.tsx: add explicit fallback={null} to <Suspense> to make intent clear (React defaults to null, but omitting it looks like an oversight) - preview-panel.tsx: restore pre passthrough in STATIC_MARKDOWN_COMPONENTS so Streamdown's wrapping <pre> doesn't nest inside the custom code block <div>, which produced invalid HTML and broken styling - file-viewer.tsx: add 'webm' to VIDEO_PREVIEWABLE_EXTENSIONS to match 'video/webm' in VIDEO_PREVIEWABLE_MIME_TYPES
1 parent 4d3da79 commit 809c9d4

5 files changed

Lines changed: 4 additions & 4 deletions

File tree

apps/sim/app/workspace/[workspaceId]/files/[fileId]/page.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export const metadata: Metadata = {
99

1010
export default function FilesFilePage() {
1111
return (
12-
<Suspense>
12+
<Suspense fallback={null}>
1313
<Files />
1414
</Suspense>
1515
)

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ const VIDEO_PREVIEWABLE_MIME_TYPES = new Set([
133133
'video/x-matroska',
134134
'video/webm',
135135
])
136-
const VIDEO_PREVIEWABLE_EXTENSIONS = new Set(['mp4', 'mov', 'avi', 'mkv'])
136+
const VIDEO_PREVIEWABLE_EXTENSIONS = new Set(['mp4', 'mov', 'avi', 'mkv', 'webm'])
137137

138138
const PPTX_PREVIEWABLE_MIME_TYPES = new Set([
139139
'application/vnd.openxmlformats-officedocument.presentationml.presentation',

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -302,6 +302,7 @@ const MermaidDiagram = memo(function MermaidDiagram({ definition }: { definition
302302
})
303303

304304
const STATIC_MARKDOWN_COMPONENTS = {
305+
pre: ({ children }: { children?: React.ReactNode }) => <>{children}</>,
305306
p: ({ children }: { children?: React.ReactNode }) => (
306307
<p className='mb-3 break-words text-[14px] text-[var(--text-primary)] leading-[1.6] last:mb-0'>
307308
{children}

apps/sim/app/workspace/[workspaceId]/files/page.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export const metadata: Metadata = {
99

1010
export default function FilesPage() {
1111
return (
12-
<Suspense>
12+
<Suspense fallback={null}>
1313
<Files />
1414
</Suspense>
1515
)

apps/sim/lib/core/security/csp.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,6 @@ const STATIC_IMG_SRC = [
6565
"'self'",
6666
'data:',
6767
'blob:',
68-
'https:',
6968
'https://*.googleusercontent.com',
7069
'https://*.google.com',
7170
'https://*.atlassian.com',

0 commit comments

Comments
 (0)