Skip to content

fix(browser): align PDF download detection with import checks - #201

Open
BigDataDZ wants to merge 1 commit into
CopilotKit:mainfrom
BigDataDZ:codex/fix-browser-pdf-prefix
Open

BigDataDZ wants to merge 1 commit into
CopilotKit:mainfrom
BigDataDZ:codex/fix-browser-pdf-prefix

Conversation

@BigDataDZ

Copy link
Copy Markdown
Contributor

PDF imports already accept a %PDF- marker within the first 1,024 bytes, but browser downloads require it at byte zero. This rejects otherwise importable PDFs with a leading BOM or padding. The existing ASCII conversion also masks high bits and can mistake non-ASCII bytes for the marker.

Retain at most 1,024 prefix bytes and search for the exact marker, matching the import check. Generated-PDF tests verify BOM/padding, a marker split across stream chunks, the exact window boundary, byte-preserving publication, and rejection/cleanup of late markers and high-bit lookalikes.

Validation: both regressions failed before the fix; PDF tests 9/9; full unit suite 486 passed, 3 platform-dependent skips, 0 failed. Repository lint, server/mobile/worker typechecks and server build pass. Independent review found no actionable issues.

Windows Chromium limitation: the profile cleanup/reopen test passes on rerun. The worker-process restart test fails because SIGTERM yields a null exit code where the fixture expects zero; the same failure was reproduced using the unmodified upstream worker. The initial run also encountered an EBUSY profile-cleanup error, which did not recur on baseline or rerun. Linux Chromium/container CI remains the integration check.

This branch has not been deployed

No deployments
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