fix(router): preserve percent-encoding in forward_path #62

Merged
zaelgohary merged 1 commit from development_fix_router_percent_encoding into development 2026-04-27 14:14:30 +00:00
Member

Summary

hero_router worker threads were panicking on any URL whose path contains percent-encoded characters (e.g. %20). service_proxy_path derived forward_path from axum's Path<(String, String, String)> extractor, which percent-decodes — so Data%20Mining... became Data Mining... (raw spaces) and hyperlocal's URI builder rejected it with InvalidUriChar.

Fix derives forward_path from the raw req.uri().path() and strips the /<service>/<webname>/ prefix, preserving encoding all the way to the upstream UDS request.

Closes #61

Changes

  • crates/hero_router/src/server/routes.rsservice_proxy_path builds forward_path from raw URI

Test Results

  • cargo fmt --check
  • cargo check --workspace
  • cargo clippy --workspace -- -D warnings
  • cargo test --workspace 79/79

Manual verification

curl -i 'http://127.0.0.1:9988/hero_office/ui/pdf/edit/Data%20Mining%20Lab%20Two-1.pdf?context=geomind' returns 200 with the expected HTML; no InvalidUriChar panics in router stderr.

## Summary hero_router worker threads were panicking on any URL whose path contains percent-encoded characters (e.g. `%20`). `service_proxy_path` derived `forward_path` from axum's `Path<(String, String, String)>` extractor, which percent-decodes — so `Data%20Mining...` became `Data Mining...` (raw spaces) and hyperlocal's URI builder rejected it with `InvalidUriChar`. Fix derives `forward_path` from the raw `req.uri().path()` and strips the `/<service>/<webname>/` prefix, preserving encoding all the way to the upstream UDS request. ## Related Issue Closes #61 ## Changes - `crates/hero_router/src/server/routes.rs` — `service_proxy_path` builds forward_path from raw URI ## Test Results - `cargo fmt --check` ✅ - `cargo check --workspace` ✅ - `cargo clippy --workspace -- -D warnings` ✅ - `cargo test --workspace` 79/79 ✅ ## Manual verification `curl -i 'http://127.0.0.1:9988/hero_office/ui/pdf/edit/Data%20Mining%20Lab%20Two-1.pdf?context=geomind'` returns 200 with the expected HTML; no `InvalidUriChar` panics in router stderr.
fix(router): preserve percent-encoding in forward_path
All checks were successful
Build & Test / check (pull_request) Successful in 1m40s
294096a6d4
Closes #61
zaelgohary merged commit 27f563f967 into development 2026-04-27 14:14:30 +00:00
zaelgohary deleted branch development_fix_router_percent_encoding 2026-04-27 14:14:30 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
lhumina_code/hero_router!62
No description provided.