Repository navigation
feat(migration-media): apply the legacy-host spelling of old-site files - #548
Merged
Merged
Conversation
When Migrate's delivery points the files it left on the old site at the address WordPress keeps after the domain move (top-level legacyOrigin in media.json), the repository names them at that host. The media apply now rewrites that spelling to the delivery URL as well, so such a repo is switched to Studio Media instead of being reported as drifted. The fetch still uses the original address from the signed origin. legacyOrigin is parsed as an https origin; anything else is refused.
Member
Author
|
ONAY @ce33609: legacyOrigin is parsed strictly (https, no credentials, normalised to the origin, else 422) and only adds a second spelling to the rewrite; fetching still uses the original address. Exact, embedded and escaped forms are covered and drift detection is unchanged. test:ci green per author (unit 2559, integration 571, nuxt 377), typecheck/lint 0. |
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.
What
Migrate can point the files it left on the old site (
studioRecommended) at the address WordPress keeps after the customer's domain moves. It writes a top-levellegacyOriginintomedia.json, and the delivered repository then names those files at that host, with the path unchanged.The media apply used to look only for the original address. On such a repository it found nothing and reported every reference as drifted. Now it rewrites both forms of the address to the Studio delivery URL:
legacyOrigin.Unchanged
studioRecommended[].urlstays as Migrate wrote it.legacyOrigin, nothing changes.Parsing
legacyOriginmust be an https origin with no credentials, and it is normalised toURL.origin. Any other value is refused with the usual 422 invalid-manifest error.Not in this PR
Fetching from the legacy host after the domain has moved. That needs the legacy host to be signed, which is a follow-up. The customer copy tells customers to move these files before moving the domain.
Tests
containsreferences (plain and\/-escaped) switch to the delivery URL, nothing is reported as drifted, and anhttp:legacyOriginis refused.pnpm test:ci: 2559 unit, 571 integration and 377 nuxt tests pass.pnpm typecheckand lint pass.