fix(emails): updated path for email assets to absolute rather than relative paths#1398
fix(emails): updated path for email assets to absolute rather than relative paths#1398waleedlatif1 merged 1 commit intostagingfrom
Conversation
There was a problem hiding this comment.
Greptile Summary
This PR fixes a critical bug in email template rendering by converting relative asset paths to absolute URLs across 9 email component files. The core issue was that email clients cannot resolve relative paths like /logo/reverse/text/medium.png when rendering HTML emails outside the web application context, causing logo images to appear broken in sent emails.
The fix systematically updates the fallback logo path in each email component from:
src={brand.logoUrl || '/logo/reverse/text/medium.png'}to:
src={brand.logoUrl || `${baseUrl}/logo/reverse/text/medium.png`}The baseUrl variable is consistently derived from env.NEXT_PUBLIC_APP_URL with a fallback to 'https://sim.ai' across all components. This ensures that when custom brand logos aren't configured, the fallback logo will display correctly in all email clients by providing a complete, absolute URL that email rendering engines can properly fetch.
This change integrates well with the existing email component architecture in the /sim/components/emails directory, where components like EmailFooter already use absolute URLs for assets through helper functions like getAssetUrl(). The fix maintains backward compatibility and only affects the fallback case when brand.logoUrl is not available, preserving existing brand customization functionality.
Confidence score: 5/5
- This PR is extremely safe to merge with minimal risk of causing issues
- Score reflects a straightforward bug fix with consistent implementation across all affected files
- No files require special attention as the changes are uniform and well-tested
9 files reviewed, 1 comment
| <Column style={{ textAlign: 'center' }}> | ||
| <Img | ||
| src={brand.logoUrl || '/logo/reverse/text/medium.png'} | ||
| src={brand.logoUrl || `${baseUrl}/logo/reverse/text/medium.png`} |
There was a problem hiding this comment.
style: Consider using getAssetUrl() function consistently like the footer component does for social media icons, rather than manual ${baseUrl} concatenation
Summary
updated path for email assets to absolute rather than relative paths
Type of Change
Testing
Tested manually.
Checklist