Skip to content

Commit 58f54c8

Browse files
committed
Merge branch 'hotfix-10.25.7' into stable
2 parents d2987d2 + b002dc1 commit 58f54c8

File tree

4 files changed

+43
-18
lines changed

4 files changed

+43
-18
lines changed

system/handlers/admin/SiteTree.cfc

+1-2
Original file line numberDiff line numberDiff line change
@@ -1198,8 +1198,7 @@ component extends="preside.system.base.AdminHandler" {
11981198
var pageId = rc.id ?: "";
11991199

12001200
if ( pageId.isEmpty() ) {
1201-
getController().getCachebox().clearAll();
1202-
announceInterception( "onClearCaches", {} );
1201+
siteTreeService.clearAllCaches();
12031202

12041203
event.audit(
12051204
action = "clear_page_cache"

system/services/security/AntiSamyService.cfc

+5-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ component {
1515

1616
// PUBLIC API
1717
public any function clean( required string input, string policy="preside" ) {
18-
var antiSamyResult = _getAntiSamy().scan( arguments.input, _getPolicy( arguments.policy ) );
18+
var dirtyHtml = ReplaceNoCase( arguments.input, """, "&~~~quot;", "all" );
19+
var antiSamyResult = _getAntiSamy().scan( dirtyHtml, _getPolicy( arguments.policy ) );
1920
var cleanHtml = antiSamyResult.getCleanHtml();
2021

2122
return _removeUnwantedCleanses( cleanHtml, arguments.policy );
@@ -72,6 +73,9 @@ component {
7273
uncleaned = uncleaned.replace( cleanedAmpersand, "&", "all" );
7374
}
7475

76+
uncleaned = ReplaceNoCase( uncleaned, """, """", "all" );
77+
uncleaned = ReplaceNoCase( uncleaned, "&~~~quot;", """, "all" );
78+
7579
return uncleaned;
7680
}
7781

system/services/siteTree/SiteTreeService.cfc

+30-15
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ component {
1717
* @websitePermissionService.inject websitePermissionService
1818
* @rulesEngineConditionService.inject rulesEngineConditionService
1919
* @cloningService.inject presideObjectCloningService
20-
* @pageCache.inject cachebox:PresidePageCache
20+
* @cachebox.inject cachebox
2121
*/
2222
public any function init(
2323
required any loginService
@@ -30,7 +30,7 @@ component {
3030
, required any websitePermissionService
3131
, required any rulesEngineConditionService
3232
, required any cloningService
33-
, required any pageCache
33+
, required any cachebox
3434
) {
3535
_setLoginService( arguments.loginService );
3636
_setPageTypesService( arguments.pageTypesService );
@@ -42,7 +42,7 @@ component {
4242
_setWebsitePermissionService( arguments.websitePermissionService );
4343
_setRulesEngineConditionService( arguments.rulesEngineConditionService );
4444
_setCloningService( arguments.cloningService );
45-
_setPageCache( arguments.pageCache );
45+
_setCachebox( arguments.cachebox );
4646
_setPageSlugsAreMultilingual();
4747

4848
if ( $isFeatureEnabled( "sitetree" ) ) {
@@ -1357,17 +1357,32 @@ component {
13571357
return page.id ?: "";
13581358
}
13591359

1360-
public void function clearPageCache( required string pageId ) {
1361-
var pageUrl = ReReplace( $getRequestContext().buildLink( page=arguments.pageId ), "^https?://.*?/", "/" );
1360+
public void function clearAllCaches() {
1361+
_getCachebox().clearAll();
1362+
$announceInterception( "onClearCaches", {} );
1363+
}
1364+
1365+
public void function clearPageCache( string pageId="", string pageUrl="" ) {
1366+
var pageUrl = ReReplace( Len( arguments.pageId ) ? $getRequestContext().buildLink( page=arguments.pageId ) : arguments.pageUrl, "^https?://.*?/", "/" );
13621367
var sectionUrl = ReReplace( pageUrl, "\.html$", "/" );
13631368

1364-
_getPageCache().clearByKeySnippet( pageUrl );
1365-
_getPageCache().clearByKeySnippet( sectionUrl );
1369+
if ( Len( pageUrl ) ) {
1370+
_getCachebox().getCache( "PresidePageCache" ).clearByKeySnippet( pageUrl );
1371+
_getCachebox().getCache( "PresidePageCache" ).clearByKeySnippet( sectionUrl );
13661372

1367-
$announceInterception( "onClearPageCaches", {
1368-
pageUrl = pageUrl
1369-
, sectionUrl = sectionUrl
1370-
} );
1373+
$announceInterception( "onClearPageCaches", {
1374+
pageUrl = pageUrl
1375+
, sectionUrl = sectionUrl
1376+
} );
1377+
}
1378+
}
1379+
1380+
public void function clearPageTypeCaches( required array pageTypes=[] ) {
1381+
var pages = _getPObj().selectData( selectFields=[ "id" ], filter={ page_type=arguments.pageTypes } );
1382+
1383+
for ( var page in pages ) {
1384+
clearPageCache( pageId=page.id );
1385+
}
13711386
}
13721387

13731388
// PRIVATE HELPERS
@@ -1821,11 +1836,11 @@ component {
18211836
_cloningService = arguments.cloningService;
18221837
}
18231838

1824-
private any function _getPageCache() {
1825-
return _pageCache;
1839+
private any function _getCachebox() {
1840+
return _cachebox;
18261841
}
1827-
private void function _setPageCache( required any pageCache ) {
1828-
_pageCache = arguments.pageCache;
1842+
private void function _setCachebox( required any cachebox ) {
1843+
_cachebox = arguments.cachebox;
18291844
}
18301845

18311846
private void function _setPageSlugsAreMultilingual() {

tests/integration/api/security/AntiSamyServiceTest.cfc

+7
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,13 @@ component extends="testbox.system.BaseSpec" {
4242
expect( antiSamy.clean( "&" ) ).toBe( "&" );
4343
} );
4444

45+
it( "should not replace "" characters in input", function(){
46+
expect( antiSamy.clean( """" ) ).toBe( """" );
47+
} );
48+
it( "should retain existing " in input", function(){
49+
expect( antiSamy.clean( """ ) ).toBe( """ );
50+
} );
51+
4552
} );
4653

4754
}

0 commit comments

Comments
 (0)