Skip to content

fix(russian/hexnovels): decode response bytes to survive NUL-truncated bodies - #2829

Open
Nreel wants to merge 1 commit into
lnreader:masterfrom
Nreel:fix/russian-hexnovels-nul-body-truncation
Open

Nreel wants to merge 1 commit into
lnreader:masterfrom
Nreel:fix/russian-hexnovels-nul-body-truncation

Conversation

@Nreel

@Nreel Nreel commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

hexnovels.me embeds the chapter list in the framework's serialized payload, which is separated by NUL bytes. The app runtime truncates res.text() at the first NUL, so parseNovel never reached the chapter data: it returned no chapters, LNReader's fetchPage threw, and the novel screen showed "Unable to load novel". The novels list was unaffected because its markup sits before the first NUL.

Fix: read the body with arrayBuffer() and decode UTF-8 manually, dropping the NUL separators. No TextDecoder/spread, so it stays Hermes-safe. Version 1.0.1 -> 1.0.2.

Measured per chapters page (decoded bytes vs what text() truncation left):

novel first NUL first chapter match before fix after fix
Лунное Наследие 280,013 287,514 0 chapters 102
Цикл Неизбежности 287,435 295,032 0 1,346
Монолог фармацевта (LN) 292,622 312,268 0 550
От герцога мне нужен только ребёнок 283,141 289,786 0 81

Verified: npm run check:plugin -- plugins/russian/hexnovels.ts -> popularNovels 40, searchNovels 2 results, parseNovel 440 chapters, parseChapter 205 chars, all PASS. npx eslint plugins/russian/hexnovels.ts clean. Also exercised in LNReader on Android (install from a locally served manifest, novel screen loads, first chapter opens).

Illustration-only chapters (e.g. "Том 1. Глава 0: Иллюстрации") contain only images, which the site stores XOR-encrypted on its CDN and decrypts inside its own service worker; there is no plaintext image URL, so the app cannot show them. parseChapter now returns a notice explaining that and pointing at the WebView action instead of an empty body.

Users whose database already holds novel rows cached from the failed loads keep getting "Unable to load novel" until they run Settings -> Advanced -> Clear cached novels (that deletes cached novels that are not in the library; library entries and downloaded chapters are untouched).

Closes #2788.

Co-authored with AI assistance.

@greptile-apps

greptile-apps Bot commented Nov 5, 2026 •

Copy link
Copy Markdown

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; no actionable issue was found in the changed code.

Summary

Updates HexNovels to read response bytes and decode UTF-8 without losing chapter data after NUL separators.

  • HexNovels chapter lists load past NUL separators.
  • Illustration-only chapters explain how readers can view their images.

No actionable issues were found. This review checked the code and related helpers; it did not independently run live-site or Android checks.

Reviews (1) · Last reviewed commit: "fix(russian/hexnovels): decode response ..." · Reviewed by Greptile

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.

all novels fails to load content/ web view missing / in url

1 participant