fix(api): decode HTML entities in plain-text email bodies - #9805
fix(api): decode HTML entities in plain-text email bodies#9805RealBhupesh wants to merge 1 commit into
Conversation
Invitation fallback URLs were keeping `&` after strip_tags, so copied links parsed amp;slug and amp;token and never loaded. Co-authored-by: Cursor <cursoragent@cursor.com>
◈ PR Lens
Architecture 1 component touched across 2 lanes. Data flow
Drill down
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (2)
Included review availability: Your plan provides up to 10 included reviews per hour; 7 remain after this review. 📝 WalkthroughWalkthroughThe email utility now decodes HTML entities after stripping HTML tags. Unit tests verify decoded invitation URLs and preserved text content without styles or tags. ChangesPlain-text email entity decoding
Priority: ➖ Normal Estimated code review effort: 2 (Simple) | ~10 minutes Severity of issue fixed: Medium Merge Risk: ⚪ Minimal · up to Plain-text email fallbacks now produce usable invitation URL query separators while HTML email escaping remains unchanged. The targeted behavior is covered and no current merge-blocking risk remains. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Description
Workspace invitation emails keep a fallback URL under “If the button doesn’t work, copy and paste this link”. HTML templates escape
&as&, andgenerate_plain_text_from_html()only stripped tags, so the plain-text part still contained&slug/&token. Copied links never loaded invitation details.This decodes entities after stripping tags in the shared helper used by invitation and other email tasks.
Related stale draft: #9522 (targets
develop/ oldapiserver/paths; current tasks already go through this helper).Type of Change
Screenshots and Media (if applicable)
N/A — full SMTP stack was not run. Verified
html.unescape(strip_tags(...))turns invitation URLs back into?invitation_id=…&slug=…&token=….Test Scenarios
generate_plain_text_from_htmldecodes&in invitation URLs and still strips<style>/ tagsslugandtoken, notamp;slug/amp;token&inhrefattributesReferences
Fixes #9497
Made with Cursor
Summary by CodeRabbit
Bug Fixes
Tests