You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 16fd0b0
Browse filesBrowse the repository at this point in the historyBrowse files
fix(parsers): decode text by encoding, sniff bytes before routing, read legacy .doc
Text parsers decoded every buffer as UTF-8 and then stripped U+FFFD, so a
Latin-1 or Windows-1252 file silently lost every accented character, a UTF-8
BOM leaked into content and broke JSON.parse, and UTF-16 only worked for
ASCII. `decodeTextBuffer` (BOM > strict UTF-8 with a guarded truncated-tail
retry > Windows-1252) now backs txt/md/csv/json/jsonl/yaml, the .doc plain-text
fallback and the connectors' text decode, and records `encoding`/`warning`
in metadata.
`parseBuffer` routed on the caller-supplied extension alone. `sniff.ts` now
identifies the bytes (PDF, OLE2, ZIP central-directory part names, ODF
mimetype, UTF-16 layout, HTML head) and reconciles them with the extension's
family: a sniffed kind with its own parser overrides the route and records
`detectedType`; binary/unknown bytes under a mismatched family are a typed
`invalid_format` instead of mojibake or placeholder prose.
Legacy OLE .doc goes through word-extractor (body, headers, footers,
footnotes, endnotes; Word 6/95 magic maps to `unsupported_type`); the byte
scrape that returned ZIP part names as degraded prose is deleted. Legacy .ppt
is dropped from the registry, upload and connector allowlists and Chat's
parseable set so it is refused up front. Chat's file reader and the internal
file tool now treat `degraded` output as a parse failure.
pdf.js `InvalidPDFException`/`FormatError`/`PasswordException` are mapped to
typed parser errors at the single `openPdfDocument` choke point, and the zip
guard's `ArchiveIntegrityError` surfaces from `parseBuffer` as a typed
`invalid_format`, so neither classifies as transient and retries forever.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
0 commit comments