Skip to content

v1.2.2 — Asset-path validation: no more broken icons, portraits & backgrounds

Choose a tag to compare

@Txpple Txpple released this 30 Jun 14:16

Hardening release — closes a rule-8 gap across the whole authoring surface.

The bug

A caller-supplied asset path (an item icon, an actor portrait/token, a scene background, an audio track, a journal image, a card face, a user avatar) was written to the Foundry document verbatim, with no check that it actually resolves. A guessed or typo'd path shipped as a broken 404 — isPlaceholderIcon only caught blank / icons/svg/ placeholders, never a non-blank path that 404s. Only add-item was guarded; every other asset-write site was not.

The fix

New shared guard — src/page/img-resolve.ts:

  • imgResolves(path) — HEAD-checks the path on the Foundry static server (trusts remote http/data URLs; fails open on a network error so a transient hiccup never strips a good path).
  • badAssetWarning(...) — one consistent warning string everywhere.
  • GENERIC_ICON for the no-kind-context substitution sites.

Applied at every caller-supplied asset write (13 sites, was 1):

  • Substitute a real icon + warn (icon/portrait/token): add-item, create-item/update-item, update-actor-item, set-actor-art (portrait + token), update-actor, set-user-avatar.
  • Drop to Foundry's default pin + warn: create-scene-notes / update-note icons.
  • Keep path + warn loudly (content-defining, no sensible substitute): create-scene/update-scene background + thumb, create-playlist tracks, create-journal image pages, add-journal-image, create-cards faces.

Each page handler returns its warnings; each tool wrapper surfaces them. Non-blocking throughout (soft-validation: warn, never block). Valid inputs write byte-identically — the new check only fires on a 404.

Confirmed no-ops: update-playlist writes no asset path; create-quest-journal has no image src; author-npc / create-actor-from-compendium already auto-resolve real art.

Gate

biome + typecheck + 992 unit tests (+11) + knip + build all green. Live integration (RELEASE.md steps 2–3) not run this cycle — valid-input live-write behavior is unchanged; the new validation only affects 404 inputs the integration suite does not exercise.