Skip to content

Open-source LLM knowledge platform: turn raw documents into a queryable RAG, an autonomous reasoning agent, and a self-maintaining Wiki.

fix(preview): stop routing legacy .doc/.ppt to the OOXML previewers

dzc-bit25a930b9a092
diff --git a/frontend/src/utils/filePreview.test.ts b/frontend/src/utils/filePreview.test.ts
index 0e7bf43e7..723b192dd 100644
--- a/frontend/src/utils/filePreview.test.ts
+++ b/frontend/src/utils/filePreview.test.ts
@@ -27,6 +27,12 @@ test('resolvePreviewKind covers office, tables, html, media, and code', () => {
assert.equal(resolvePreviewKind('pdf'), 'pdf')
assert.equal(resolvePreviewKind('docx'), 'docx')
assert.equal(resolvePreviewKind('pptx'), 'pptx')
+ // Legacy OLE2 formats are not parseable by the OOXML previewers and must
+ // degrade to the unsupported state instead of failing with a zip error.
+ assert.equal(resolvePreviewKind('doc'), 'unsupported')
+ assert.equal(resolvePreviewKind('ppt'), 'unsupported')
+ // SheetJS renders legacy .xls fine, so it stays previewable.
+ assert.equal(resolvePreviewKind('xls'), 'excel')
assert.equal(resolvePreviewKind('png'), 'image')
assert.equal(resolvePreviewKind('svg'), 'image')
assert.equal(resolvePreviewKind('md'), 'markdown')
diff --git a/frontend/src/utils/filePreview.ts b/frontend/src/utils/filePreview.ts
index 77e62d06f..b451c525f 100644
--- a/frontend/src/utils/filePreview.ts
+++ b/frontend/src/utils/filePreview.ts
@@ -36,8 +36,12 @@ function register(kind: FilePreviewKind, exts: string[]) {
}
register('pdf', ['pdf'])
-register('docx', ['docx', 'doc'])
-register('pptx', ['pptx', 'ppt'])
+// .doc (Word 97-2003) and .ppt (PowerPoint 97-2003) are legacy OLE2 binary
+// formats, while the docx/pptx previewers only parse OOXML (ZIP/XML) and
+// would fail with a raw zip error; leaving them unregistered degrades to the
+// unsupported-preview state with a download entry instead.
+register('docx', ['docx'])
+register('pptx', ['pptx'])
register('image', [
'jpg', 'jpeg', 'png', 'gif', 'bmp', 'webp', 'tiff', 'tif', 'svg', 'svgz',
'ico', 'avif', 'apng', 'jfif', 'pjpeg', 'pjp', 'heic', 'heif',