[nu-demo] Media seed data writes storage_path with leading slash — '/Photos/foo.jpg' breaks photo/video/song URLs #24
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
In the Photos, Songs, Videos islands on heronu, media was listed by name (so OSIS records existed) but all
<img>/<audio>/<video>elements failed to load. Directcurlof the expected webdav URL returned 404.Root cause
The media seed data (session 13 / homenu seeding) writes photo records with:
…leading slash.
In the Photos island, the client-side URL is built as:
Where
download_base_urlalready ends with/(becausehero_foundry_webdav_client::WebDavClient::files_api_urlalways adds a trailing slash for the directory form). So the concatenation produces:hero_router's file handler interprets the double-slash as an empty segment and 404s.
Secondary observation
New photos uploaded through the Photos island UI
services/mod.rs:73write:…no leading slash. So new uploads work, only seeded data is broken. This is why the bug was session-13 specific: whoever wrote the initial media seed used a leading slash; the live upload code didn't.
Demo fix applied on heronu (2026-04-24)
Read every
photo/song/videorecord in each seeded context, strip the leading slash fromstorage_path, write back via{kind}.set. 30 records fixed (9 photos in geomind, 3 in threefold/root/incubaid each, plus 3 each of song + video per context). Verified:curl 'http://10.1.2.2:9988/hero_foundry/rpc/api/files/geomind/Photos/beach_retreat.jpg'now returns 34,206-byte JPEG.Script:
/home/driver/fix_photo_paths.pyon heronu (runs viapython3 fix_photo_paths.py).Proper fixes (3 independent)
1. Fix seed data (the real fix)
Wherever media is seeded (
hero_osis_media/scripts, nu-shellservice_osis.nu, or a dedicated seed tool) — write paths asPhotos/foo.jpg, not/Photos/foo.jpg. Normalize on ingest.2. Defensive URL construction in photos_grid.rs (belt-and-suspenders)
Same change in Songs (songs_grid.rs) and Videos (videos_grid.rs) — any island that does the same concatenation. This is a pure WASM fix, so it needs a hero_os_app rebuild.
3. Normalize on write in OSIS
The
photo.set/song.set/video.sethandlers could strip leading slashes fromstorage_pathbefore persisting. Prevents future seeds from reintroducing the bug.Related
Verification
After either fix (1), (2), or (3):
In the browser, open Photos island in
geomindorthreefoldcontext → all 9 (or 3) thumbnails should render.Signed-off-by: mik-tf
Originally filed as home#156 on 2026-04-24 by mik-tf — moved to hero_demo as part of consolidating issue tracking.