Skip to content

URL rewriting in migrated content #192

@tayebmokni

Description

@tayebmokni

Summary

URL rewriting in converted content per doc 08 §5 stage 5 and §6.2. Any url/src attribute pointing at the old site's wp-content/uploads/... is resolved through the attachment-map: strip ?ver= query string, look up source path, replace with new URL. Handles WP's per-size suffixes (image-1024x768.jpg) by stripping the suffix and resolving the base. Unresolvable URLs emit media_url_unresolved warning and the original URL is left untouched (will 404 visibly, with a logged warning).

Design reference

  • docs/08-migration-compat.md §5 stage 5, §6.2

Acceptance criteria

  • rewriteMediaURLs(tree, attachmentMap) walks the block tree
  • Replaces src/url/href attrs in core/image, core/gallery, core/cover, core/audio, core/video, core/file
  • Strips ?ver= and other query params before lookup
  • Handles size-suffix patterns (-NNNxNNN, -scaled) by stripping → resolving base
  • Multi-pattern URL detection: handles bare hostnames, protocol-relative, absolute, and CDN-fronted URLs (per §18 risk list)
  • media_url_unresolved warning emitted for unresolved URLs
  • Verification step samples 50 images and HEAD-checks them (per §18)
  • Tests cover all sources + size suffixes

Dependencies

#html-to-blocks, #media-migration

Complexity

M

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:migrationWordPress importer + compatphase:P5-migrationPhase 5 — Migrationpriority:P1Important — should land in phaseskill:goGo programmingtype:featNew feature or implementation task

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions