Skip to content

fix: correct asset URL rewriting during push (PROD-915)#120

Open
AaronAgility wants to merge 2 commits intolatest-betafrom
fix/asset-url-mapping-PROD-915
Open

fix: correct asset URL rewriting during push (PROD-915)#120
AaronAgility wants to merge 2 commits intolatest-betafrom
fix/asset-url-mapping-PROD-915

Conversation

@AaronAgility
Copy link
Collaborator

Summary

  • Bug: The mapAssetUrl method in content-field-mapper.ts was accessing originUrl, url, and edgeUrl on an AssetMapping object — properties that don't exist on that type. The as any cast masked the TypeScript error, causing every asset URL lookup to silently fall through and return the original source URL unchanged. Asset URLs were never being rewritten during push operations.
  • Fix: Removed the as any cast and now correctly returns assetMapping.targetUrl (the target instance's edge URL) when a mapping is found, falling back to the original sourceUrl only when targetUrl is not set.

References

PROD-915

Test plan

  • Run a push operation between two instances that have mapped assets and verify that asset URLs in content fields are rewritten to the target instance's edge URLs
  • Verify that unmapped asset URLs are left unchanged (fallback to sourceUrl)
  • Confirm TypeScript compiles without errors (no more as any needed)

🤖 Generated with Claude Code

AaronAgility and others added 2 commits March 20, 2026 15:22
The mapAssetUrl method was accessing originUrl/url/edgeUrl on an
AssetMapping object, but those properties only exist on mgmtApi.Media.
The `as any` cast masked the type error, causing every lookup to
fall through to returning the original source URL unchanged.

Now correctly returns assetMapping.targetUrl when a mapping is found.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Asset mappings now store container edge/origin URLs and use them as a
fallback when exact URL matching fails. This handles content items that
reference assets via subfolder paths (e.g. /mobile/feature-carousel/)
which differ from the root edgeUrl stored in the mapping.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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