diff --git a/frontend/src/components/AttachmentUpload.vue b/frontend/src/components/AttachmentUpload.vue index ce3cc0ea..b575a771 100644 --- a/frontend/src/components/AttachmentUpload.vue +++ b/frontend/src/components/AttachmentUpload.vue @@ -48,7 +48,7 @@ let disposed = false; // Supported file types (matching backend) const supportedTypes = ref([ // Documents - '.pdf', '.doc', '.docx', '.xls', '.xlsx', '.ppt', '.pptx', '.epub', '.mhtml', + '.pdf', '.doc', '.docx', '.xls', '.xlsx', '.ppt', '.pptx', '.epub', '.mhtml', '.xmind', // Text '.txt', '.md', '.csv', '.json', '.xml', '.html', '.markdown', '.yaml', '.yml', '.log', diff --git a/frontend/src/utils/fileTypeVerification.test.ts b/frontend/src/utils/fileTypeVerification.test.ts index 338f9ef6..8b1cc376 100644 --- a/frontend/src/utils/fileTypeVerification.test.ts +++ b/frontend/src/utils/fileTypeVerification.test.ts @@ -14,3 +14,13 @@ test('shouldRejectKnowledgeFileType preserves dynamic whitelist behavior', () => assert.equal(shouldRejectKnowledgeFileType('page.html', ['pdf']), true) assert.equal(shouldRejectKnowledgeFileType('page.html', []), false) }) + +test('XMind uploads work before engine discovery and respect discovered capabilities', () => { + for (const filename of ['architecture.xmind', 'ARCHITECTURE.XMIND']) { + assert.equal(shouldRejectKnowledgeFileType(filename), false) + assert.equal(shouldRejectKnowledgeFileType(filename, []), false) + assert.equal(shouldRejectKnowledgeFileType(filename, new Set()), false) + assert.equal(shouldRejectKnowledgeFileType(filename, ['pdf', 'xmind']), false) + assert.equal(shouldRejectKnowledgeFileType(filename, ['pdf']), true) + } +}) diff --git a/frontend/src/utils/fileTypeVerification.ts b/frontend/src/utils/fileTypeVerification.ts index 24d46ddd..586678e2 100644 --- a/frontend/src/utils/fileTypeVerification.ts +++ b/frontend/src/utils/fileTypeVerification.ts @@ -7,6 +7,7 @@ const DEFAULT_VALID_TYPES = new Set([ "pptx", "ppt", "epub", + "xmind", "html", "htm", "mhtml", diff --git a/internal/application/service/temporary_document.go b/internal/application/service/temporary_document.go index 2c478d3f..af6def7e 100644 --- a/internal/application/service/temporary_document.go +++ b/internal/application/service/temporary_document.go @@ -83,7 +83,8 @@ var markdownImagePattern = regexp.MustCompile(`!\[[^\]]*\]\([^)]*\)`) var temporaryDocumentExtensions = map[string]struct{}{ ".docx": {}, ".doc": {}, ".pdf": {}, ".ppt": {}, ".pptx": {}, ".epub": {}, ".mhtml": {}, - ".xlsx": {}, ".xls": {}, + ".xmind": {}, + ".xlsx": {}, ".xls": {}, ".md": {}, ".markdown": {}, ".txt": {}, ".csv": {}, ".json": {}, ".xml": {}, ".yaml": {}, ".yml": {}, ".log": {}, ".html": {}, ".jpg": {}, ".jpeg": {}, ".png": {}, ".gif": {}, ".bmp": {}, ".tiff": {}, ".webp": {}, ".mp3": {}, ".wav": {}, ".m4a": {}, ".flac": {}, ".ogg": {}, ".aac": {}, diff --git a/internal/application/service/temporary_document_test.go b/internal/application/service/temporary_document_test.go index 09b663d7..aa6d2729 100644 --- a/internal/application/service/temporary_document_test.go +++ b/internal/application/service/temporary_document_test.go @@ -80,6 +80,16 @@ func TestApproxTextContentRunes(t *testing.T) { } } +func TestTemporaryDocumentSupportsXMindWithoutEngineDiscovery(t *testing.T) { + svc := &temporaryDocumentService{} + if !svc.supportsExtension(context.Background(), 1, ".xmind") { + t.Fatal("XMind must be accepted even when engine discovery is unavailable") + } + if svc.supportsExtension(context.Background(), 1, ".exe") { + t.Fatal("unsupported attachments must still be rejected") + } +} + func TestCollectImageBytes(t *testing.T) { refs := []types.ImageRef{ {ImageData: []byte("a")},