From 2132bb12806a66c20744e2cf1f62186d42adee7f Mon Sep 17 00:00:00 2001 From: Angel Borroy <48685308+aborroy@users.noreply.github.com> Date: Mon, 27 Jan 2020 15:13:56 +0100 Subject: [PATCH] SEARCH-2071 Escaping JSON strings for Authorities and Property values. (#517) Using Freemarker "json_string" function instead of ad-hoc code, as it's provided by default from 2.3.1 version --- .../org/alfresco/repository/solr/solr.lib.ftl | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/main/resources/alfresco/templates/webscripts/org/alfresco/repository/solr/solr.lib.ftl b/src/main/resources/alfresco/templates/webscripts/org/alfresco/repository/solr/solr.lib.ftl index 7ab7706c3d..11a6325be0 100644 --- a/src/main/resources/alfresco/templates/webscripts/org/alfresco/repository/solr/solr.lib.ftl +++ b/src/main/resources/alfresco/templates/webscripts/org/alfresco/repository/solr/solr.lib.ftl @@ -1,6 +1,3 @@ -<#macro json_string string>${string?js_string?replace("\\'", "\'")?replace("\\>", ">")} - - <#macro aclChangeSetJSON aclChangeSet> { "id": ${aclChangeSet.id?c}, @@ -24,14 +21,14 @@ "readers" : [ <#list aclReaders.readers as reader> - "${reader?string}" + "${reader?json_string}" <#if reader_has_next>, ], "denied" : [ <#list aclReaders.denied as denied> - "${denied?string}" + "${denied?json_string}" <#if denied_has_next>, ] @@ -54,7 +51,7 @@ "txnId": ${node.txnId?c}, "status": "<#if node.deleted>d<#else>u", <#if node.aclId??>"aclId": ${node.aclId?c}, - <#if node.shardPropertyValue??>"shardPropertyValue": "${node.shardPropertyValue?string}", + <#if node.shardPropertyValue??>"shardPropertyValue": "${node.shardPropertyValue?json_string}", <#if node.explicitShardId??>"explicitShardId": "${node.explicitShardId?c}", "tenant": "${node.tenant}" } @@ -151,7 +148,7 @@ <#if filter.includeOwner??> <#if nodeMetaData.owner??> - , "owner": "${nodeMetaData.owner}" + , "owner": "${nodeMetaData.owner?json_string}" }