Skip to content

Fix asymmetric mujoco-assets/ prefix matching in buildZipCandidates - #4

Open
midasbal wants to merge 1 commit into
AxisAIOrg:mainfrom
midasbal:fix/zip-candidate-prefix-matching
Open

Fix asymmetric mujoco-assets/ prefix matching in buildZipCandidates#4
midasbal wants to merge 1 commit into
AxisAIOrg:mainfrom
midasbal:fix/zip-candidate-prefix-matching

Conversation

@midasbal

Copy link
Copy Markdown

What

buildZipCandidates in src/lib/mujoco-asset-loader.ts matched asset paths
asymmetrically across the two asset-prefix flavors. A reference using the
hyphen prefix (mujoco-assets/) never generated the underscore candidate
(mujoco_assets/<stem>), so an asset stored in the zip under the underscore
prefix was missed. It also emitted useless doubled-prefix candidates such as
mujoco-assets/mujoco-assets/....

Why it matters

When the XML references mujoco-assets/... and the zip stores
mujoco_assets/..., the zip lookup misses. With zipOnly enabled this throws
Asset not found in zip and the asset fails to load; otherwise it silently
falls back to an individual fetch.

Fix

Derive a single prefix-agnostic stem (strip whichever known prefix is present)
and build candidates from it: normalized, stem, mujoco-assets/<stem>,
mujoco_assets/<stem>. Matching is now symmetric.

Verification

  • mujoco-assets/tex/wood.png ref vs mujoco_assets/tex/wood.png entry: now matches (was a miss).
  • mujoco_assets/... ref vs mujoco-assets/... entry: still matches.
  • Bare-stem ref matches either stored prefix, and vice versa.
  • An unrelated asset still does not match.

Notes

Scoped to the one function; no dependencies or config changed. The repo has no
test runner, so I did not add one here. Happy to add a regression test covering
both prefix directions if you'd like to adopt one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant