Skip to content

Support xlinkHref attribute for SVG image elements#724

Draft
Copilot wants to merge 3 commits intomainfrom
copilot/fix-xlinkhref-attribute
Draft

Support xlinkHref attribute for SVG image elements#724
Copilot wants to merge 3 commits intomainfrom
copilot/fix-xlinkhref-attribute

Conversation

Copy link

Copilot AI commented Feb 7, 2026

SVG <image> elements only recognized href as the image source attribute, causing errors when using the JSX/React-compatible xlinkHref prop.

// This worked
<svg><image href="data:image/..." /></svg>

// This threw "Image source is not provided"
<svg><image xlinkHref="data:image/..." /></svg>

Changes

src/handler/preprocess.ts

  • Line 125: Check both href and xlinkHref when resolving image data from cache
  • Lines 159-166: Collect image sources from both props.href and props.xlinkHref during preprocessing

test/image.test.tsx

  • Added test case with xlinkHref attribute including xmlns:xlink namespace declaration

The existing ATTRIBUTE_MAPPING already handles the xlinkHrefxlink:href conversion for SVG output.

Original prompt

This section details on the original issue you should resolve

<issue_title>xlinkHref isn't interpreted as source for <image /> in SVGs</issue_title>
<issue_description># Bug report

Description / Observed Behavior

Using namespaced attribute in JSX form like xlinkHref instead of xlink:href causes error "Image source is not provided" to be thrown.

Expected Behavior

Satori should use the JSX/TSX attribute xlinkHref as the <image /> source, interpreting it the same it does xlink:href and href.

Reproduction

Using xlink:href (works)

[Using xlinkHref (doesn't work)](https://og-playground.vercel.app/?share=5Vlpb-LIFv0riNGT-sk98YI3Mt0jGTCLbQx4w0aRRt6wDd5XoNX__ZUJJCQ9ip70kg9vYilR1anruvcc36q62D-6duK43fvuNyeoH-JOpyiPofv9x4-23en4buD55X3noYsiyL8eul8f4SZwSv8X1AmKNDSPLb4N3cMT3nZGQe7aZZDE7aidhFUUP42bYeDFs9KNivOgG5du_jS4q4oy2B6HCUDjcySvDLZgRA5O7n2HQLEbbH0JnUSQC1q6h5Jpff0yy8-fD_GfbeNbUXs3FL8_dHsI8tC9FeMlVgduM0gOAEQ6SAcMtH_XwW0QhmAkTmL3Ch2iMC4A5pdleg_DTdPcNb27JPdgDEEQuHV_a6mHQbz_W3O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vIuKYgmOiTqi8jhbCQguUJhzJRywjbINAab5bD7dKy5-Z6VoqlloXISNqRGjOUgmKQEGsGUVM2jVZqfsr285wzhFm6WauJp_M...


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

@vercel
Copy link
Contributor

vercel bot commented Feb 7, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
satori-playground Ready Ready Preview, Comment, Open in v0 Feb 7, 2026 1:42pm

Co-authored-by: shuding <3676859+shuding@users.noreply.github.com>
Co-authored-by: shuding <3676859+shuding@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix interpretation of xlinkHref for image source in SVGs Support xlinkHref attribute for SVG image elements Feb 7, 2026
Copilot AI requested a review from shuding February 7, 2026 13:45
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.

xlinkHref isn't interpreted as source for <image /> in SVGs

2 participants