fix(foundry): URL-decode path segments in files_api #20

Merged
zaelgohary merged 1 commit from development_fix_url_decode_paths into development 2026-04-27 14:15:05 +00:00
Member

Summary

handle_files_api read req.uri().path() and used the raw path segment as the literal filename — never decoding percent-encoding. Callers that follow the standard urlencode(filename) convention (e.g. hero_office_server::socket_dav::put_file) ended up storing files with %20 baked into the filename, and round-trip GETs failed (404).

Fix decodes both context and file_path before any filesystem operation. Round-trip with spaces in the filename now works.

Closes #19

Changes

  • crates/hero_foundry_server/Cargo.toml — add percent-encoding = "2.3"
  • crates/hero_foundry_server/src/http/files_api.rs — decode context + file_path

Test Results

  • cargo check --workspace
  • cargo test --workspace (no failures across crates)

Manual verification

  • PUT /api/files/geomind/new test file.txt then ls shows literal-spaces filename on disk
  • GET on URL-encoded path returns the file (no 404)
  • hero_office editor view renders previously-broken PDFs after deploy
## Summary `handle_files_api` read `req.uri().path()` and used the raw path segment as the literal filename — never decoding percent-encoding. Callers that follow the standard `urlencode(filename)` convention (e.g. `hero_office_server::socket_dav::put_file`) ended up storing files with `%20` baked into the filename, and round-trip GETs failed (404). Fix decodes both context and file_path before any filesystem operation. Round-trip with spaces in the filename now works. ## Related Issue Closes #19 ## Changes - `crates/hero_foundry_server/Cargo.toml` — add `percent-encoding = "2.3"` - `crates/hero_foundry_server/src/http/files_api.rs` — decode context + file_path ## Test Results - `cargo check --workspace` ✅ - `cargo test --workspace` ✅ (no failures across crates) ## Manual verification - PUT `/api/files/geomind/new test file.txt` then `ls` shows literal-spaces filename on disk - GET on URL-encoded path returns the file (no 404) - hero_office editor view renders previously-broken PDFs after deploy
fix(foundry): URL-decode path segments in files_api
Some checks failed
Build and Test / build (pull_request) Failing after 0s
1ec39d0a9c
Closes #19
zaelgohary merged commit 4a1ebde800 into development 2026-04-27 14:15:05 +00:00
zaelgohary deleted branch development_fix_url_decode_paths 2026-04-27 14:15:05 +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_foundry!20
No description provided.