Skip to content

fix(import): resolve passthrough-stored assets referenced by absolute path - #405

Open
tommy230 wants to merge 1 commit into
CoreBunch:mainfrom
tommy230:pr/passthrough-asset-fallback
Open

fix(import): resolve passthrough-stored assets referenced by absolute path#405
tommy230 wants to merge 1 commit into
CoreBunch:mainfrom
tommy230:pr/passthrough-asset-fallback

Conversation

@tommy230

Copy link
Copy Markdown

Summary

An import bundle can store a binary under passthrough/wp-content/... while its HTML references /wp-content/.... resolveAndRecord strips the leading slash and does one exact FileMap lookup, so the asset is never planned. The unreferenced-media sweep still uploads the bytes, but nothing records a usage, and the published page 404s on the URL the HTML declares.

A WordPress export surfaced this: the site published cleanly except for its mobile logo and an address icon, both stored under passthrough/ and both referenced root-relative from every page.

After an exact miss, resolveAndRecord now retries the same key under passthrough/ before giving up. An exact key still wins when both exist, and external URLs and unresolvable paths behave as before.

Related: #349 reports unresolved references and matches punctuation drift, but its normalisation keeps path segments, so it cannot match the passthrough/ storage prefix. The two are complementary; this lookup slots into that PR's resolver chain if it lands first.

Verification

  • bun run build
  • bun test
  • bun run lint
  • Docker/deployment check, if relevant

New coverage in assetPlan.test.ts: a root-relative img src resolves to its passthrough-stored file, and an exact FileMap key is preferred over its passthrough counterpart. The first fails without the fix.

Checklist

  • Tests cover behavior changes.
  • Docs were updated when behavior, config, deployment, or public surfaces changed.
  • No compatibility shim was added for old pre-release behavior.
  • No secrets, local databases, uploads, or generated artifacts are included.

Fall back to passthrough-prefixed FileMap entries when exact asset paths are absent.
Cover passthrough resolution and preserve exact-key precedence.
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