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
This commit is contained in:
waleed
2026-04-27 19:59:44 -07:00
parent 4d3da794d8
commit 809c9d451f
5 changed files with 4 additions and 4 deletions

View File

@@ -9,7 +9,7 @@ export const metadata: Metadata = {
export default function FilesFilePage() {
return (
<Suspense>
<Suspense fallback={null}>
<Files />
</Suspense>
)

View File

@@ -133,7 +133,7 @@ const VIDEO_PREVIEWABLE_MIME_TYPES = new Set([
'video/x-matroska',
'video/webm',
])
const VIDEO_PREVIEWABLE_EXTENSIONS = new Set(['mp4', 'mov', 'avi', 'mkv'])
const VIDEO_PREVIEWABLE_EXTENSIONS = new Set(['mp4', 'mov', 'avi', 'mkv', 'webm'])
const PPTX_PREVIEWABLE_MIME_TYPES = new Set([
'application/vnd.openxmlformats-officedocument.presentationml.presentation',

View File

@@ -302,6 +302,7 @@ const MermaidDiagram = memo(function MermaidDiagram({ definition }: { definition
})
const STATIC_MARKDOWN_COMPONENTS = {
pre: ({ children }: { children?: React.ReactNode }) => <>{children}</>,
p: ({ children }: { children?: React.ReactNode }) => (
<p className='mb-3 break-words text-[14px] text-[var(--text-primary)] leading-[1.6] last:mb-0'>
{children}

View File

@@ -9,7 +9,7 @@ export const metadata: Metadata = {
export default function FilesPage() {
return (
<Suspense>
<Suspense fallback={null}>
<Files />
</Suspense>
)

View File

@@ -65,7 +65,6 @@ const STATIC_IMG_SRC = [
"'self'",
'data:',
'blob:',
'https:',
'https://*.googleusercontent.com',
'https://*.google.com',
'https://*.atlassian.com',