mirror of
https://github.com/readest/readest.git
synced 2026-12-01 13:36:39 +00:00
The KOReader plugin's "Push reading stats" failed every time with "The server is temporarily unavailable". The reporter's KOReader log has the server's answer: HTTP 500 "unsupported Unicode escape sequence". PostgreSQL can't store U+0000 in text, so one "\u0000" in a JSON string fails the whole statement. KOReader's statistics database can hold a book title or author with a NUL byte, and the plugin's dkjson encoder sends it as \u0000. The stat_books upsert then returns 500. The push cursor only advances on success, so every later push resent the same chunk and failed. Books and notes already strip NUL with sanitizeString in transform.ts. The stat_books upsert added later never did. Run its title and authors through the same helper. Since the fix is server-side, older plugins work once web is deployed. Verified: - New test sync-strip-nul.test.ts (its mock rejects \u0000 like PostgREST). Without the fix: "expected 500 to be 200". With it: passes. - PostgreSQL 15: json_populate_recordset with "A\u0000B" gives "unsupported Unicode escape sequence"; the same row with "AB" inserts. - pnpm test: all files pass. pnpm lint: clean. - Not run: a real push from KOReader against a server with this fix. The reporter's device is a Kobo, and which book holds the NUL is unknown. Reported on Reddit, with the KOReader log sent by email. Co-authored-by: Claude Code (Claude Opus 5.5) <noreply@anthropic.com> |
||
|---|---|---|
| .. | ||
| readest-app | ||
| readest-calibre-plugin | ||
| readest-crosspoint-plugin | ||
| readest.koplugin | ||