-
Notifications
You must be signed in to change notification settings - Fork 908
fix(render): decode HTML entities in href and style tags #2920
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: canary
Are you sure you want to change the base?
fix(render): decode HTML entities in href and style tags #2920
Conversation
React's SSR escapes special characters to HTML entities which breaks: - URLs with query parameters (&) causing issues with click tracking - CSS media queries in style tags (>) breaking Tailwind responsive utilities This adds post-processing to decode entities in: - href attribute values - <style> tag contents Fixes resend#1767 Fixes resend#2841
🦋 Changeset detectedLatest commit: 5026fb7 The changes in this PR will be included in the next version bump. This PR includes changesets to release 6 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 |
|
@Suhaib3100 is attempting to deploy a commit to the resend Team on Vercel. A member of the Team first needs to authorize it. |
commit: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1 issue found across 6 files
Prompt for AI agents (all issues)
Check if these issues are valid — if so, understand the root cause of each and fix them.
<file name="packages/render/src/shared/utils/decode-html-entities.spec.ts">
<violation number="1" location="packages/render/src/shared/utils/decode-html-entities.spec.ts:6">
P2: Rule violated: **No `should` in tests**
Test descriptions must not include the word "should" (rule: "No `should` in tests"). Rewrite these descriptions in direct, declarative language (e.g., "decodes & in href attributes").</violation>
</file>
Since this is your first cubic review, here's how it works:
- cubic automatically reviews your code and comments on bugs and improvements
- Teach cubic by replying to its comments. cubic learns from your replies and gets better over time
- Ask questions if you need clarification on any suggestion
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
Summary
Fixes React SSR escaping HTML entities that break email functionality.
Problem
React's SSR escapes special characters to HTML entities which causes:
&→&in href attributes - breaks click tracking services (Azure Communication Services, etc.)>→>in style tags - breaks CSS media queries like@media (width>=48rem)Solution
Added a post-processing step in
render()that selectively decodes HTML entities in:hrefattribute values - decodes&→&<style>tag contents - decodes>,<,&This is a targeted fix that doesn't affect text content where entities should remain encoded.
Changes
decodeHtmlEntitiesutility inpackages/render/src/shared/utils/Testing
Fixes #1767
Fixes #2841
Summary by cubic
Decode HTML entities in SSR output to fix broken email links and CSS. This prevents click tracking URLs and media queries from failing in rendered emails.
Written for commit 5026fb7. Summary will update on new commits.