[nu-demo] Books island builds URL as {base}/ + /rpc → double-slash 404 in All Books / library listing #157
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
Symptom
Books island All Books tab (and library tabs) shows:
…with no books listed, despite
libraries.listvia direct socket RPC returning all 4 configured libraries (hero, geomind, mycelium, ourworld = 40 books).Root cause
hero_archipelagos/archipelagos/embed/books/src/island.rs:28builds the island's base URL with a trailing slash:The Dioxus island's RPC client at
hero_archipelagos/archipelagos/embed/books/src/services/mod.rs:42then concatenates/rpc:Resulting URL:
/hero_books/ui//rpc— double slash.Axum's router on hero_books_ui doesn't normalize consecutive slashes, so
/rpc(registered route) ≠//rpc(incoming path) → 404 → empty body → JSON parse error in the island's fetch handler.Verification
Same double-slash issue likely affects every island that follows this base_url pattern. Searches for
format!("{}/..."with trailing slash + subsequentformat!("{}/...: photos_grid had a similar bug (see home#156).Demo fix (applied on heronu
development_mik_nu_demo)Added
collapse_slashes_middlewareto hero_books_ui's Axum router — runs before routing, rewrites request URI to collapse consecutive slashes in the path. Full patch inhero_books_ui/src/main.rs— ~30 lines inc. middleware fn and one.layer(...)call. Rebuild time: ~60s (one crate).After rebuild + restart:
curl 'http://10.1.2.2:9988/hero_books/ui//rpc' -X POST ...→ 200 (same as single-slash)Proper fixes (3 layers)
1. Root cause (the correct fix)
hero_archipelagos/archipelagos/embed/books/src/island.rs:28:Requires full hero_os_app WASM rebuild (~25 min). Same one-char fix needed in any other island whose base_url has trailing slash — audit.
2. Defensive URL construction in rpc_call
hero_archipelagos/archipelagos/embed/books/src/services/mod.rs:42:Apply the same pattern to every
format!("{}/..."in the island's services module. Sibling fix to #156 (photos_grid needed the same treatment).3. Server-side normalization (belt-and-suspenders)
Keep the
collapse_slashes_middlewarein hero_books_ui (and every other *_ui crate behind hero_router) as a guard against future WASM regressions. Alternative: add slash-collapse in hero_router's proxy so ALL services benefit without per-service middleware.Related
storage_path; here the bug is in base_url construction).ai/<page>.tomlbecause content_hash doesn't match the post-export .mdSigned-off-by: mik-tf
make demotarget — provision + install + seed + verify a fresh Hero OS demo VM in one command #163webfeature build — OSIS/Services have only native variants, Services is dead wood, Videos missing, Books needs iframe default #171Verified resolved in current code 2026-04-25
hero_books_app/src/rpc.rs:46-51correctly uses:trim_end_matches('/')strips any trailing slash on the base before appending/rpc, so trailing-slash bases produce single-slash URLs.Tested live on herodemo.gent01.grid.tf:
Closing as fixed. If the double-slash 404 is still observed in any path, please reopen with the exact URL and I'll trace.
Signed-off-by: mik-tf
{base}/+/rpc→ double-slash 404 in All Books / library listing #25Moved to hero_demo#25 — see lhumina_code/hero_demo#25
make demotarget — provision + install + seed + verify a fresh Hero OS demo VM in one command #31webfeature build — OSIS/Services have only native variants, Services is dead wood, Videos missing, Books needs iframe default #34