[GH-ISSUE #1604] Chat-list character avatars 404 (asset.localhost path has no avatars directory) #830

Closed
opened 2026-10-21 05:21:35 +07:00 by bsakaguchi · 0 comments
Owner

Originally created by @Romuromylus on GitHub (May 29, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/1604

Originally assigned to: @Promansis on GitHub.

Summary

Character avatars in the chat list (Convo / RP / GM) render broken. The avatar <img> resolves to a Tauri asset-protocol URL like http://asset.localhost/<...>/com.marinara-engine.app/avatars/<uuid>.png, but the request returns HTTP 404, so naturalWidth is 0 and a broken-image fragment shows instead of the portrait.

Evidence (refactor HEAD, pnpm tauri dev, Windows)

  • RecentChats.tsx renders <img src={characterAvatarUrl(char)} style={getAvatarCropStyle(...)}>. The resolved src for an affected character is e.g. http://asset.localhost/C:\Users\<user>\AppData\Roaming\com.marinara-engine.app\avatars\<uuid>.png.
  • fetch() of that URL returns status=404; the <img> reports complete=true, naturalWidth=0.
  • The app-data bundle %APPDATA%\com.marinara-engine.app\ contains backgrounds, data, fonts, game-assets but no avatars/ directory, while ~30 character records reference avatars/<uuid>.png.
  • The crop style is correct (getAvatarCropStyle emits a normal 100% × 119.79%), and game-mode sprites + bundled icons load fine. Only the asset.localhost character-avatar files 404.

Two parts

  1. Missing-file resilience (clear gap): RecentChats.tsx renders the <img> whenever avatarUrl is truthy, with no onError fallback. A 404/missing avatar should fall back to the name-initial placeholder (already implemented for the no-avatar case) instead of showing a broken image. This is worth fixing regardless of why the file is missing.
  2. Root cause of the 404 (needs triage): either the avatar binaries were never written to this bundle's avatars/ dir, or the write path and read path disagree. Read path: src/features/catalog/characters/lib/character-avatar-url.ts -> src/shared/api/local-file-api (asset protocol). Write path: src-tauri/src/commands/storage/avatars.rs. Avatar loading was last touched by #1590.

Impact

Every character avatar whose file is absent from avatars/ renders as a broken image across the chat list (and anywhere characterAvatarUrl is used), rather than degrading to the initial.

Originally created by @Romuromylus on GitHub (May 29, 2026). Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/1604 Originally assigned to: @Promansis on GitHub. ## Summary Character avatars in the chat list (Convo / RP / GM) render broken. The avatar `<img>` resolves to a Tauri asset-protocol URL like `http://asset.localhost/<...>/com.marinara-engine.app/avatars/<uuid>.png`, but the request returns HTTP 404, so `naturalWidth` is 0 and a broken-image fragment shows instead of the portrait. ## Evidence (refactor HEAD, `pnpm tauri dev`, Windows) - `RecentChats.tsx` renders `<img src={characterAvatarUrl(char)} style={getAvatarCropStyle(...)}>`. The resolved src for an affected character is e.g. `http://asset.localhost/C:\Users\<user>\AppData\Roaming\com.marinara-engine.app\avatars\<uuid>.png`. - `fetch()` of that URL returns `status=404`; the `<img>` reports `complete=true`, `naturalWidth=0`. - The app-data bundle `%APPDATA%\com.marinara-engine.app\` contains `backgrounds`, `data`, `fonts`, `game-assets` but **no `avatars/` directory**, while ~30 character records reference `avatars/<uuid>.png`. - The crop style is correct (`getAvatarCropStyle` emits a normal `100% × 119.79%`), and game-mode sprites + bundled icons load fine. Only the `asset.localhost` character-avatar files 404. ## Two parts 1. **Missing-file resilience (clear gap):** `RecentChats.tsx` renders the `<img>` whenever `avatarUrl` is truthy, with no `onError` fallback. A 404/missing avatar should fall back to the name-initial placeholder (already implemented for the no-avatar case) instead of showing a broken image. This is worth fixing regardless of why the file is missing. 2. **Root cause of the 404 (needs triage):** either the avatar binaries were never written to this bundle's `avatars/` dir, or the write path and read path disagree. Read path: `src/features/catalog/characters/lib/character-avatar-url.ts` -> `src/shared/api/local-file-api` (asset protocol). Write path: `src-tauri/src/commands/storage/avatars.rs`. Avatar loading was last touched by #1590. ## Impact Every character avatar whose file is absent from `avatars/` renders as a broken image across the chat list (and anywhere `characterAvatarUrl` is used), rather than degrading to the initial.
bsakaguchi 2026-10-21 05:21:35 +07:00
Sign in to join this conversation.
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
Pasta-Devs/Marinara-Engine#830
No description provided.