Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.
Python agentagentic-aiagentic-frameworkagentic-workflowaiautomationclaudedeepseekgenaigptllmlow-codemcpnextjsno-codeopenaipythonskillsworkflow
fix: guard chat file preview rendering when mime type is missing (#35355)
hyl64f56ce9d3b1ad
diff --git a/web/app/components/base/file-uploader/file-uploader-in-chat-input/__tests__/file-item.spec.tsx b/web/app/components/base/file-uploader/file-uploader-in-chat-input/__tests__/file-item.spec.tsxindex c03f009cee8..00dd7d9971e 100644--- a/web/app/components/base/file-uploader/file-uploader-in-chat-input/__tests__/file-item.spec.tsx+++ b/web/app/components/base/file-uploader/file-uploader-in-chat-input/__tests__/file-item.spec.tsx@@ -222,6 +222,21 @@ describe('FileItem (chat-input)', () => {expect(document.querySelector('audio')).not.toBeInTheDocument()})+ it('should not throw when file type is missing', () => {+ expect(() => {+ render(+ <FileItem+ file={createFile({+ name: 'generated.png',+ type: undefined as unknown as string,+ supportFileType: 'document',+ })}+ canPreview+ />,+ )+ }).not.toThrow()+ })+it('should close video preview', () => {render(<FileItemdiff --git a/web/app/components/base/file-uploader/file-uploader-in-chat-input/file-item.tsx b/web/app/components/base/file-uploader/file-uploader-in-chat-input/file-item.tsxindex 34056a85d5c..a23d616481e 100644--- a/web/app/components/base/file-uploader/file-uploader-in-chat-input/file-item.tsx+++ b/web/app/components/base/file-uploader/file-uploader-in-chat-input/file-item.tsx@@ -36,6 +36,7 @@ const FileItem = ({const [previewUrl, setPreviewUrl] = useState('')const ext = getFileExtension(name, type, isRemote)const uploadError = progress === -1+ const [typeCategory = '', typeSubtype = ''] = type?.split('/') ?? []let tmp_preview_url = url || base64Urlif (!tmp_preview_url && file?.originalFile)@@ -121,7 +122,7 @@ const FileItem = ({</div></div>{- type.split('/')[0] === 'audio' && canPreview && previewUrl && (+ typeCategory === 'audio' && canPreview && previewUrl && (<AudioPreviewtitle={name}url={previewUrl}@@ -130,7 +131,7 @@ const FileItem = ({)}{- type.split('/')[0] === 'video' && canPreview && previewUrl && (+ typeCategory === 'video' && canPreview && previewUrl && (<VideoPreviewtitle={name}url={previewUrl}@@ -139,7 +140,7 @@ const FileItem = ({)}{- type.split('/')[1] === 'pdf' && canPreview && previewUrl && (+ typeSubtype === 'pdf' && canPreview && previewUrl && (<PdfPreview url={previewUrl} onCancel={() => { setPreviewUrl('') }} />)}