From b4a28343dad42d88ea662a044f10284efa02a819 Mon Sep 17 00:00:00 2001 From: Dominic Watson Date: Tue, 12 Jul 2022 18:14:46 +0100 Subject: [PATCH] #62 fix extension renderers and add some defensive code for content rendering issues --- handlers/renderers/content/DataApiPageLink.cfc | 2 ++ .../renderers/content/DataApiPageLinkArray.cfc | 2 +- services/DataApiService.cfc | 14 ++++++++++---- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/handlers/renderers/content/DataApiPageLink.cfc b/handlers/renderers/content/DataApiPageLink.cfc index 667216d..4c212e1 100644 --- a/handlers/renderers/content/DataApiPageLink.cfc +++ b/handlers/renderers/content/DataApiPageLink.cfc @@ -6,5 +6,7 @@ component { if ( pageId.len() ) { return event.buildLink( page=pageId ); } + + return ""; } } \ No newline at end of file diff --git a/handlers/renderers/content/DataApiPageLinkArray.cfc b/handlers/renderers/content/DataApiPageLinkArray.cfc index 76c8d30..1bf2467 100644 --- a/handlers/renderers/content/DataApiPageLinkArray.cfc +++ b/handlers/renderers/content/DataApiPageLinkArray.cfc @@ -1,6 +1,6 @@ component { - private string function default( event, rc, prc, args={} ){ + private array function default( event, rc, prc, args={} ){ var pages = ListToArray( args.data ?: "" ); for( var i=1; i<=pages.len(); i++ ) { diff --git a/services/DataApiService.cfc b/services/DataApiService.cfc index 6d45e28..0481f88 100644 --- a/services/DataApiService.cfc +++ b/services/DataApiService.cfc @@ -325,13 +325,19 @@ component { } if ( $getContentRendererService().rendererExists( renderer, "dataapi" ) ) { - var renderedContent = $renderContent( renderer, arguments.value, "dataapi", arguments.fieldSettings ); - if ( Len( renderedContent ?: "" ) ) { - return renderedContent; + try { + var renderedContent = $renderContent( renderer, arguments.value, "dataapi", arguments.fieldSettings ); + if ( Len( renderedContent ?: "" ) ) { + return renderedContent; + } + } catch( any e ) { + $raiseError( e ); } - } + if ( Len( arguments.value ?: "" ) ) { + return arguments.value; + } return $isFeatureEnabled( "dataApiUseNullForStrings" ) ? NullValue() : ""; }