Skip to content

Image Editor - Getting 404 when using rooted url #16

Description

@Technorocker

Issue 2 — Image Editor 404s on any asset with a rooted url

Severity: Image Editor unusable for affected assets

What happens

Opening an asset in the Image Editor shows "Failed to load image (404)" with an empty canvas. The same
asset displays correctly in the Assets grid.

Cause

ImageEditorPage.jsx:141 resolves the image via buildAssetUrl({ url: imageUrl }), where imageUrl comes
from the url query param — which is a rooted path:

url=/assets/images/T-Pose-ff22ee4f/76dd18c2-.../1785794111511-407918632.png

buildAssetUrl() (src/utils/meshTexturing.js:1535) normalises with:

const normalizedPath = String(rawPath)
  .replace(/\\/g, '/')
  .replace(/^data\/assets\//, '')
  .replace(/^assets\//, '')
return assetUrl(normalizedPath)

Both regexes are anchored at ^ without allowing a leading slash, so /assets/images/… matches
neither. assetUrl() then prepends /assets/ again, producing:

/assets//assets/images/… → 404

The Assets grid is unaffected because it uses asset.url directly in an <img src> (AssetsPage.jsx:1201)
without re-normalising.

Reproduce

  1. Generate an asset so it gets a rooted url (edits under images/<name>/<uuid>/… reliably do)
  2. Open it in the Image Editor → 404, empty canvas
  3. Network tab shows the doubled /assets//assets/ path

Suggested fix

Allow an optional leading slash — one regex covers all four shapes:

.replace(/^\/?(?:data\/)?assets\//, '')

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions