fix(import): resolve passthrough-stored assets referenced by absolute path - #405
Open
tommy230 wants to merge 1 commit into
Open
fix(import): resolve passthrough-stored assets referenced by absolute path#405tommy230 wants to merge 1 commit into
tommy230 wants to merge 1 commit into
Conversation
Fall back to passthrough-prefixed FileMap entries when exact asset paths are absent. Cover passthrough resolution and preserve exact-key precedence.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
An import bundle can store a binary under
passthrough/wp-content/...while its HTML references/wp-content/....resolveAndRecordstrips 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,
resolveAndRecordnow retries the same key underpassthrough/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 buildbun testbun run lintNew 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