mirror of
https://github.com/infiniflow/ragflow.git
synced 2026-11-12 06:10:52 +08:00
## Summary Tag files with `.xls` extension were accepted by the extension check in `parseTagSourceByFilename` but always produced an empty tag index: `parseXLSXTagSource` used only `excelize.OpenReader`, which rejects OLE BIFF workbooks (`unsupported workbook file format`). This makes legacy Excel 97-2003 tag files unusable while the docs claim `XLSX, XLS, CSV, TXT` support. This PR routes OLE-magic `.xls` bytes to a new BIFF8 reader (`go-excel-reader`, already used by the document `XLSParser`), applying the identical per-row rule as `.xlsx`. ## Related Issue None (follow-up of #10602 / #10660 which fixed document-side `.xls`; tag side was left behind). ## Changes - `internal/ingestion/component/tag_source.go` - Detect OLE compound-document magic and route to new `parseBIFF8TagSource` (fallback to `excelize` for OOXML-renamed `.xls`). - `parseBIFF8TagSource`: per-sheet, no-header, first two non-empty cells form `(content, tags)`; single-cell rows accumulate; extra cells ignored. - Extract shared `accumulateTagCells` helper (removes xlsx/BIFF8 loop duplication); simplify `tagCellString` (drop redundant `string` case). - Fix `unsupported extension` error text to include `.xls`. - `internal/ingestion/component/tag_biff8_test.go` (new): `TestParseBIFF8TagSource` with an xlwt-generated BIFF8 fixture (3 examples incl. single-cell accumulation). ## Test Plan - `bash build.sh --test ./internal/ingestion/component/ -run 'TestParseBIFF8TagSource|TestParseTagSourceByFilename$|TestParseXLSXTagSource' -v` — all PASS. - `bash build.sh --test ./internal/ingestion/component/` — full package PASS (~16s). - Real-file check: document `XLSParser` parses 4 genuine `.xls` fixtures (`produced=true`); same bytes via tag path previously returned `count=0`, now return 3 tag examples.