Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions system/config/Config.cfc
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,8 @@ component {
interceptorSettings.customInterceptionPoints.append( "postEditRecordAction" );
interceptorSettings.customInterceptionPoints.append( "preRenderRecordForViewRecord" );
interceptorSettings.customInterceptionPoints.append( "postRenderRecordForViewRecord" );
interceptorSettings.customInterceptionPoints.append( "prePrepareEmailHtmlContent" );
interceptorSettings.customInterceptionPoints.append( "postGetLayoutConfig" );
}

private void function __setupCachebox() {
Expand Down
8 changes: 7 additions & 1 deletion system/services/email/EmailLayoutService.cfc
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,13 @@ component {
}
}

return config;
var interceptorArgs = {
config = config
, args = arguments
};
$announceInterception( "postGetLayoutConfig", interceptorArgs );

return interceptorArgs.config;
}

// PRIVATE HELPERS
Expand Down
5 changes: 4 additions & 1 deletion system/services/email/EmailTemplateService.cfc
Original file line number Diff line number Diff line change
Expand Up @@ -1617,8 +1617,11 @@ component {
, unsubscribeLink
, template
, viewOnline
, cacheSuffix = ""
) {
var cacheKey = ( $helpers.isTrue( arguments.useDefaultContent ?: "" ) ? "default" : "saved" ) & "rawhtml" & arguments.template;
$announceInterception( "prePrepareEmailHtmlContent", arguments );

var cacheKey = arguments.cacheSuffix ?: ( $helpers.isTrue( arguments.useDefaultContent ?: "" ) ? "default" : "saved" ) & "rawhtml" & arguments.template;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Empty cache key causes all emails to share cache

High Severity

The Elvis operator (?:) only checks for null, not empty strings. Since cacheSuffix defaults to "" (line 1620), the expression arguments.cacheSuffix ?: (...) evaluates to "" instead of the fallback cache key calculation. This causes all email templates without an explicit cacheSuffix to share the same empty string cache key, resulting in the first rendered email being returned for all subsequent emails. The original logic constructed unique keys per template, but this change breaks that behavior.

Fix in Cursor Fix in Web

var fromCache = _getTemplateCache().get( cacheKey );

if ( !IsNull( local.fromCache ) ) {
Expand Down