fix(upload): accept XMind files before parser engine discovery
parent
da049f04e0
commit
58260d192c
|
|
@ -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',
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
}
|
||||
})
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ const DEFAULT_VALID_TYPES = new Set([
|
|||
"pptx",
|
||||
"ppt",
|
||||
"epub",
|
||||
"xmind",
|
||||
"html",
|
||||
"htm",
|
||||
"mhtml",
|
||||
|
|
|
|||
|
|
@ -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": {},
|
||||
|
|
|
|||
|
|
@ -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")},
|
||||
|
|
|
|||
Loading…
Reference in New Issue