Skip to content

fix(knowledge): allow xlsx in URL import (#2447) - #2452

Merged
lyingbug merged 4 commits into
Tencent:mainfrom
lyingbug:fix/url-import-xlsx-2447
Jul 31, 2026
Merged

fix(knowledge): allow xlsx in URL import (#2447)#2452
lyingbug merged 4 commits into
Tencent:mainfrom
lyingbug:fix/url-import-xlsx-2447

Conversation

@lyingbug

@lyingbug lyingbug commented Jul 31, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Fix #2447: URL-based knowledge import (POST /knowledge-bases/:id/knowledge/url) now accepts the same file types as direct upload (including xlsx, xls, csv) by reusing isValidFileType instead of a narrower whitelist.
  • Align URL file import with direct upload validation: shared resolveKnowledgeFileImportConfig enforces file type, video rejection, and default VLM/ASR prerequisites.
  • Enqueue DataTableSummaryTask for spreadsheet URL imports (create + reparse), matching direct upload behavior.
  • Stop tracking local .cursor IDE config (hooks/rules) in git.

Test plan

  • go test ./internal/application/service/ -count=1
  • go test ./internal/application/service/ -run 'TestIsAllowedFileURLExtension|TestIsValidFileTypeHTML|TestValidateImportFileType|TestResolveKnowledgeFileImportConfig|TestApplyKnowledgeProcessOverrides'
  • POST /api/v1/knowledge-bases/:id/knowledge/url with {"url": "...", "file_name": "test.xlsx", "file_type": "xlsx"} returns success: true
  • Verify unsupported types (e.g. exe) still return 400
  • Verify xlsx URL import enqueues both document process and datatable summary tasks

lyingbug added 4 commits July 31, 2026 12:34
…t#2447)

Align URL-based file import validation with direct file upload by
delegating to isValidFileType instead of a narrower whitelist.
Remove .cursor hooks from the repo and drop gitignore exceptions so
local Cursor rules and hooks stay out of version control.
Extract shared file-import checks (type, VLM/ASR, video) into
resolveKnowledgeFileImportConfig and reuse them for file URL import.
Also enqueue DataTableSummaryTask for spreadsheet URL imports and reparse.
…le gate

The xlsx URL-import fix left the accepted extension set reachable through two
indirections and widened ApplyKnowledgeProcessOverrides to gate file types for
callers that are not file imports (web URL fetch, connector sync, reparse).

Collapse the set into one map that both isValidFileType and the extension check
read, move the shared validation next to the other file-type predicates, and
return ApplyKnowledgeProcessOverrides to its override-only scope so
resolveFileImportProcessConfig is the only import gate.

Also drop the unreachable branch in createKnowledgeFromFileURL: getFileType
never yields an empty string, so the resolvedFileType fallback and its else arm
could not run. Normalize the resolved type before it reaches the record and the
task payload, and add an invariant test asserting direct upload and URL import
accept the same extensions so Tencent#2447 cannot drift back.
@lyingbug
lyingbug merged commit 8dd997f into Tencent:main Jul 31, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant