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 48f7308
Browse filesBrowse the repository at this point in the historyBrowse files
fix(parsers): close audit findings on byte sniffing, decoding and legacy formats
Routing and the KB pipeline:
- A non-PDF named .pdf (HTML error page, plain text) is rejected as a
permanent `invalid_file` in `readEmbeddedPdfText` instead of being indexed
as the "text layer" or sent to OCR to fail terminally; the document
processor logs `detectedType`/`warning` at info with the filename (no
document id is in scope in that module).
- The HTML override now applies only to `.txt` and `.md` (a `.md` opening
with `<!DOCTYPE html>` is deliberately treated as HTML); an HTML document
under csv/json/jsonl/yaml is `invalid_format`.
- RTF (`{\rtf` at offset 0) is a sniffed kind and is `unsupported_type`
under any extension, so control words are never indexed as prose.
- `%PDF-` is searched through the first KiB only under a declared `.pdf`;
elsewhere it must be at offset 0 (after BOM/whitespace), so a `.txt` that
mentions the magic string stays text.
- NUL bytes in a declared text file keep the text route: the decoder handles
UTF-16/Windows-1252 and the sanitizer strips stray NULs. Recognised
containers under a text extension are still refused.
- `resolveParserExtension` throws `FileParserError('unsupported_type')`, so
stored `.ppt` documents dead-letter as permanent instead of burning the
retry budget as transient.
- Workspace-file "get content" (`internal/file/operations.ts`) treats
`degraded` output as a parse failure like the other two tool paths.
Decoding:
- Windows-1252 uses the runtime `TextDecoder` when a module-init self-test
proves the label is real (Bun 1.3.14), else a one-pass table decode into
UTF-16 code units. 100 MB of C1 bytes: 379 ms / +200 MB native,
286 ms / +401 MB table (was ~4 s / +5.4 GB).
- Connectors sftp, s3, databricks, google-drive and bitbucket decode through
`decodeTextBuffer` (bitbucket previously skipped non-UTF-8 files; it now
indexes them decoded). Connectors hash source revisions (blob sha, etag,
rev), not decoded text, so there is no mass re-sync: documents indexed
earlier with mojibake stay as they are until the source changes.
Legacy .doc: text boxes are a sixth extracted section; word-extractor's raw
`RangeError` text is replaced by the stable "This .doc file could not be
read".
Behaviour notes: UTF-32 input is not recognised and decodes as Windows-1252;
BOM-less UTF-16 whose code units are mostly non-ASCII (CJK) does not match
the NUL-layout heuristic and also falls to Windows-1252 — the warning now
says the file may use another encoding. Stale `.ppt` mentions removed from
the files-audit OpenAPI description (regenerated), the Box representation
list, `OFFICE_REPAIR_EXTENSIONS` and two TSDoc blocks; the package.json
re-sort from the previous commit is reverted.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Copy file name to clipboardExpand all lines: apps/docs/openapi-v2-files-audit.json
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -745,7 +745,7 @@
745
745
"get": {
746
746
"operationId": "readFileText",
747
747
"summary": "Read File Text",
748
-
"description": "Extract text without changing the file. Use Unzip File to unpack archives or Download File for original bytes. Unsupported types return `400`, compiling documents return `409`, and oversized files return `413`. `degraded: true` indicates incomplete or synthesized text, including some legacy `.doc` and `.ppt` results; `truncated: true` indicates a parser limit.\n\nOAuth scope: `api:read`.",
748
+
"description": "Extract text without changing the file. Use Unzip File to unpack archives or Download File for original bytes. Unsupported types return `400`, compiling documents return `409`, and oversized files return `413`. `degraded: true` indicates incomplete or synthesized text, such as the legacy `.pptx` fallback; `truncated: true` indicates a parser limit.\n\nOAuth scope: `api:read`.",
Copy file name to clipboardExpand all lines: apps/sim/lib/api/contracts/v2/openapi/files-audit.ts
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -393,7 +393,7 @@ const declaredRoutes = [
393
393
operationId: 'readFileText',
394
394
summary: 'Read File Text',
395
395
description:
396
-
'Extract text without changing the file. Use Unzip File to unpack archives or Download File for original bytes. Unsupported types return `400`, compiling documents return `409`, and oversized files return `413`. `degraded: true` indicates incomplete or synthesized text, including some legacy `.doc` and `.ppt` results; `truncated: true` indicates a parser limit.',
396
+
'Extract text without changing the file. Use Unzip File to unpack archives or Download File for original bytes. Unsupported types return `400`, compiling documents return `409`, and oversized files return `413`. `degraded: true` indicates incomplete or synthesized text, such as the legacy `.pptx` fallback; `truncated: true` indicates a parser limit.',
0 commit comments