BcpackHistory: accept a UTF-8 BOM in the history JSON #31
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/breadbbbb--rpf9-explorer!31
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/31/head"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@throny on GitHub · 2026-11-23 18:25 UTC · original
bcpack-history-bom→main· +5 −1 · 1 files · 1 commits · merged 2026-11-23 22:30 UTCBcpackHistory.Loadfails on a history JSON that starts with a UTF-8 BOM (EF BB BF), which Windows PowerShell 5.1Out-File/>writes by default: exit 2,'0xEF' is an invalid start of a value.Cause:
ReadDocument(from #22) passes the raw file bytes toJsonDocument.Parse, which does not accept a BOM.Fix: skip the 3 BOM bytes before parsing. Every other error path is unchanged (bad JSON, non-object root, empty file).
Tested (no game files; no test project in the repo, so a scratch console app outside the repo calling
BcpackHistory.Load):[1], and malformed JSON: stillInvalidDataExceptionas before (BOM-only now reports "no JSON tokens",[1]"expected a JSON object")dotnet build -c Releaseof Core, App and IndexBuilder: 0 warnings, 0 errorsAI-assisted. Came up in review of ItsNotRexed/Leonida#4050.
🤖 Generated with Claude Code
ReadDocument passed the raw bytes to JsonDocument, which rejects a leading EF BB BF ('0xEF' is an invalid start of a value). Skip the BOM before parsing; all other errors are unchanged. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>@breadbbbb on GitHub · 2026-11-23 22:28 UTC · original · approved these changes
The Release core build passed. I called BcpackHistory.Load with the same BC1 object in plain UTF-8 and UTF-8 with a BOM. Both loaded. A BOM-only file, a BOM-prefixed array, and malformed JSON all still raised InvalidDataException.