-
Notifications
You must be signed in to change notification settings - Fork 11.6k
Fix/email subtitle html entities 26938 #26947
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
Fix/email subtitle html entities 26938 #26947
Conversation
Allows attendees to edit name, email, phone, and timezone on booking page. Includes new tRPC router, modal component, and comprehensive tests.
Applied extensive typing to onChange handlers to satisfy strict linting rules.
Added logic to maintain data consistency: when an attendee name changes, the booking title (if it contains the name) is now automatically updated to reflect the new name.
Updated sprite.svg and icon-names.ts to match local build environment.
|
Hey there and thank you for opening this pull request! 👋🏼 We require pull request titles to follow the Conventional Commits specification and it looks like your proposed title needs to be adjusted. Details: |
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.
3 issues found across 15 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/emails/src/renderEmail.ts">
<violation number="1" location="packages/emails/src/renderEmail.ts:40">
P1: HTML entities are decoded after renderToStaticMarkup, unescaping user-controlled text (e.g., < or >) into real tags and reintroducing HTML injection in email output.</violation>
</file>
<file name="packages/trpc/server/routers/publicViewer/updateAttendeeDetails.handler.ts">
<violation number="1" location="packages/trpc/server/routers/publicViewer/updateAttendeeDetails.handler.ts:77">
P2: Falsy guard rejects valid empty-string updates; use undefined checks for field presence</violation>
</file>
<file name="apps/web/modules/bookings/views/bookings-single-view.tsx">
<violation number="1" location="apps/web/modules/bookings/views/bookings-single-view.tsx:1134">
P1: Edit attendee flow lacks authorization: public mutation allows updating attendee details with only booking UID and email</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
| </main> | ||
|
|
||
| {/* Edit Attendee Details Modal */} | ||
| {currentAttendee && ( |
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.
P1: Edit attendee flow lacks authorization: public mutation allows updating attendee details with only booking UID and email
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At apps/web/modules/bookings/views/bookings-single-view.tsx, line 1134:
<comment>Edit attendee flow lacks authorization: public mutation allows updating attendee details with only booking UID and email</comment>
<file context>
@@ -1112,6 +1129,22 @@ export default function Success(props: PageProps) {
</main>
+
+ {/* Edit Attendee Details Modal */}
+ {currentAttendee && (
+ <EditAttendeeDetails
+ bookingUid={bookingInfo.uid}
</file context>
packages/trpc/server/routers/publicViewer/updateAttendeeDetails.handler.ts
Show resolved
Hide resolved
9cf5b3a to
e37a21b
Compare
|
Thanks for your work, going with this one:- #26949 |
Fix: Decode HTML Entities in Email Templates
📋 Summary
Fixes issue where special characters (forward slashes, quotes, etc.) were displaying as HTML entity codes in email templates instead of the actual characters.
Example:
Carina / Test still needs to confirm...Carina / Test still needs to confirm...🔗 Related Issue
Fixes #26938
Problem
When Cal.com sends emails (booking confirmations, password resets, reschedule requests, etc.), special characters in dynamic content like user names were being HTML-encoded by React's rendering but not properly decoded before sending. This resulted in HTML entity codes (e.g.,
/,") being visible to email recipients instead of the actual characters (/,").Affected Areas
Solution
Implemented a two-layer fix:
1. Global Email Rendering Fix (
renderEmail.ts)Added an HTML entity decoding step in the email rendering pipeline that:
2. Subtitle Component Fix (
EmailScheduledBodyHeaderContent.tsx)Added entity decoding specifically for subtitle text in booking-related emails as an additional safeguard.
3. Dependencies
Added
[email protected]package to@calcom/emailsfor reliable HTML entity decoding.Changes Made
Files Modified
packages/emails/src/renderEmail.tsdecodeHTMLContent()helper functionpackages/emails/src/components/EmailScheduledBodyHeaderContent.tsxgetDecodedSubtitle()helper functionpackages/emails/package.jsonentitiespackage dependencyTesting
Manual Testing Performed
/in name/,",&, etc.Test Results
All emails now correctly display special characters:
/(not/)"(not")&(not&)Automated Tests
Created test utilities in development:
packages/emails/test-entity-decode.ts- Validates entity decoding logic📸 Screenshots
Before Fix
Example from issue #26938:
After Fix
Fixed output:
Technical Details
How It Works
The fix works by adding a decoding step in the email rendering pipeline:
The
decodeHTMLContent()function uses a regex to find text between HTML tags and decode entities only in text content, preserving the HTML structure.Why This Approach?
entitiespackage already in use elsewhere in Cal.com✅ Checklist
Impact
Scope
Backward Compatibility
✅ Fully backward compatible
📚 Additional Context
This issue was particularly visible when users had names like:
John / CompanyJane "The Boss" DoeSmith & JonesThe HTML entities would appear in all email communications, creating a poor user experience.
Acknowledgments
/in email #26938For Reviewers
Key Areas to Review
renderEmail.ts- Entity decoding logic and regex patternEmailScheduledBodyHeaderContent.tsx- Subtitle decoding implementationTesting Instructions
Test / User/not/