fix(markdown): escape double quotes in link href/title and image title - #3590
Conversation
Image src/alt were already escaped, but link href, link title, and image title were interpolated raw. A title like 'The "Complete" Guide' or an href with a quoted query value broke out of the attribute in the rendered HTML. Escape them the same way.
🦋 Changeset detectedLatest commit: 0aef517 The changes in this PR will be included in the next version bump. This PR includes changesets to release 3 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
@yashs33244 is attempting to deploy a commit to the resend Team on Vercel. A member of the Team first needs to authorize it. |
There was a problem hiding this comment.
No issues found across 3 files
Confidence score: 5/5
- Automated review surfaced no issues in the provided summaries.
- No files require special attention.
Auto-approved: Fixes an HTML attribute escaping bug in the Markdown renderer by applying the same replaceAll pattern already used for image src/alt to link href/title and image title. The change is small (3 files, 23 lines), isolated, test-covered, and does not affect any snapshots.
Re-trigger cubic
commit: |
What
The
Markdownrenderer escapes double quotes in imagesrcandalt, but not in linkhref, linktitle, or imagetitle- those are interpolated raw into the attribute:So a markdown title that contains a double quote breaks out of the attribute:
The same happens for an image title and for an href that contains a quote.
Fix
Apply the same
.replaceAll('"', '"')already used for imagesrc/altto linkhref, linktitle, and imagetitle. Added a regression test rendering a link and image whose title/href contain quotes. Existing snapshots are unaffected.Summary by cubic
Escape double quotes in
react-email’sMarkdownrenderer for linkhref/titleand imagetitleto prevent HTML attribute breakouts, matching the existing escaping for imagesrc/alt. Adds a regression test that covers quotes in link/image titles and hrefs.Written for commit 0aef517. Summary will update on new commits.